Tools are the bridge between the LLM's intentions and your local environment. Each tool defines what it can do, what inputs it accepts, and whether it's safe to run in parallel.

How tools work

  1. The LLM decides which tool to call and with what arguments
  2. The agent validates the input against the tool's schema
  3. Permission checks run (allow/deny/ask based on your rules)
  4. The tool executes and returns a result
  5. The result is sent back to the LLM for the next step

Tool categories

File operations

ToolWhat it does
FileReadRead files with line numbers. Handles text, PDF (via pdftotext), Jupyter notebooks, and images (base64 for vision).
FileWriteCreate or overwrite files. Auto-creates parent directories.
FileEditSearch-and-replace within files. Requires unique match unless replace_all is set.
NotebookEditEdit Jupyter notebook cells (replace, insert, delete).
ToolWhat it does
GrepRegex content search powered by ripgrep. Supports context lines, glob filtering, case sensitivity.
GlobFind files by pattern, sorted by modification time.
ToolSearchDiscover available tools by keyword or direct name.

Execution

ToolWhat it does
BashRun shell commands with timeout, background execution, destructive command detection, and output truncation.
REPLExecute Python or Node.js code snippets in an interpreter.

Agent coordination

ToolWhat it does
AgentSpawn subagents for parallel tasks with optional git worktree isolation.
SendMessageSend messages between running agents.
SkillInvoke user-defined skills programmatically.

Planning and tracking

ToolWhat it does
EnterPlanMode / ExitPlanModeToggle read-only mode for safe exploration.
TaskCreate / TaskUpdate / TaskGet / TaskList / TaskStop / TaskOutputFull task lifecycle management.
TodoWriteStructured todo list management.

Web and external

ToolWhat it does
WebFetchHTTP GET with HTML-to-text conversion.
WebSearchWeb search with result extraction.
LSPLanguage server diagnostics with linter fallbacks.

MCP integration

ToolWhat it does
McpProxyCalls tools on connected MCP servers.
ListMcpResourcesBrowse MCP server resources.
ReadMcpResourceRead a specific MCP resource by URI.

Workspace

ToolWhat it does
EnterWorktree / ExitWorktreeCreate and manage isolated git worktrees.
AskUserQuestionPrompt the user with structured multi-choice questions.
SleepAsync pause with cancellation.

Concurrency

Tools declare whether they're safe to run in parallel:

  • Read-only tools (FileRead, Grep, Glob, etc.) run concurrently
  • Mutation tools (Bash, FileWrite, FileEdit) run serially

This maximizes throughput while preventing race conditions on file writes.

Result handling

Tool results larger than 64KB are automatically persisted to disk (~/.cache/agent-code/tool-results/). The conversation receives a truncated preview with a file path reference so the full output isn't lost.

Writing custom tools

See Custom Tools for how to implement the Tool trait and register new tools.