Tools¶
Tool (pycodeloop.abc.tool.Tool) is the interface for any action the agent can take:
class Tool(ABC):
name: str
description: str
parameters: dict # JSON schema
dangerous: bool = False
def schema(self) -> dict: ...
def preview(self, **kwargs) -> str: ...
def run(self, **kwargs) -> ToolResult: ...
Built-in tools¶
| Tool | Purpose | dangerous |
|---|---|---|
read_file |
Read a file, optionally a line range | No |
write_file |
Create or overwrite a file | Yes |
edit_file |
Replace an exact substring in a file | Yes |
delete_file |
Delete a file | Yes |
list_dir |
List a directory | No |
glob |
Find files matching a glob pattern | No |
grep |
Regex search across files | No |
bash |
Run a shell command with a timeout | Yes |
web_fetch |
Fetch a URL and extract its text | No |
http_request |
Call a JSON HTTP API — any method, headers, body | Yes |
git_status |
git status --porcelain=v1 --branch |
No |
git_diff |
Unstaged (or staged) changes as a unified diff | No |
git_log |
Recent commit history, one line per commit | No |
git_commit |
Stage files and create a commit | Yes |
env |
Read environment variables (sensitive values masked) | No |
todo |
Scratchpad checklist for multi-step tasks | No |
DEFAULT_TOOLS (pycodeloop.core.tools.DEFAULT_TOOLS) is that list, ready to pass into Config.
Dangerous tools and preview¶
A tool marked dangerous = True gets a confirmation gate: before Agent runs it, it calls tool.preview(**arguments) and passes the result to the confirm hook. If confirm returns False, the tool never runs and the model is told "User declined to run this tool."
preview() defaults to a repr of the arguments, but the built-in dangerous tools override it:
write_file/edit_file/delete_file— a unified diff of what would changebash— the literal command line ($ ...)- MCP tools — the call rendered as
tool_name(arg=value, ...)
See Permission prompts for how the CLI renders this.
MCP tools¶
Tools don't have to be local Python code. pycodeloop.core.mcp.load_mcp_tools(server) connects to a Model Context Protocol server and returns its remote tools already wrapped as Tool instances — the agent can't tell an MCP tool from a local one. See MCP servers.
Skills¶
When skills discovery is on, Config appends a read_skill tool and lists every discovered skill in the system prompt, so the agent can pull one in on demand. See Skills.
Writing your own¶
See Custom tools.