TOOL_DIRECTORY [T2]
Complete registry of the 40+ tools the LLM can invoke. Each tool has an input schema, permission model, and execution function. Registered in src/tools.ts, defined in src/Tool.ts (794 lines).
BashTool
src/tools/BashTool/
Execute shell commands with PTY support. Handles timeouts, background processes, sandboxing. The most-used tool.
FileReadTool
src/tools/FileReadTool/
Read files with line numbers (cat -n format). Supports images, PDFs, notebooks. Offset/limit for large files.
FileEditTool
src/tools/FileEditTool/
Exact string replacement in files. old_string/new_string with uniqueness check. replace_all mode available.
FileWriteTool
src/tools/FileWriteTool/
Write entire file contents. Requires prior Read. Overwrites existing files. Prefer Edit for modifications.
GrepTool
src/tools/GrepTool/
Ripgrep-powered content search. Regex, glob filters, multiline, context lines. 3 output modes: content, files, count.
GlobTool
src/tools/GlobTool/
Fast file pattern matching. Supports **/*.ts globs. Returns paths sorted by modification time. Any codebase size.
AgentTool
src/tools/AgentTool/
Spawn autonomous subagents. Each gets its own context, tools, and conversation. Supports background execution and worktrees.
SendMessageTool
src/tools/SendMessageTool/
Continue a previously spawned agent by sending a follow-up message. Resumes with full context preserved.
AskUserQuestionTool
src/tools/AskUserQuestionTool/
Request clarification from the user. Pauses execution until the user responds. Used when genuinely stuck.
TaskCreate / Update / List / Get
src/tools/TaskCreateTool/ + 3 more
Break work into tracked tasks. Create, update status (in_progress/completed), list, get details. Gated by TodoV2 flag.
TaskOutputTool / TaskStopTool
src/tools/TaskOutputTool/ + TaskStopTool/
Read output from running tasks. Stop tasks that are no longer needed. Essential for agent orchestration.
EnterPlanMode / ExitPlanMode
src/tools/EnterPlanModeTool/ + ExitPlanModeTool/
Switch to plan mode for designing implementation strategies. Restricts to read-only tools. Exit when ready to execute.
WebFetchTool
src/tools/WebFetchTool/
Fetch URLs and extract content. Handles HTML, JSON, text. Converts HTML to readable markdown.
WebSearchTool
src/tools/WebSearchTool/
Search the web via API. Returns ranked results with titles, URLs, snippets. Used for documentation lookups.
MCPTool / ListResources / ReadResource
src/tools/MCPTool/ + 2 more
Call tools on external MCP servers. List and read MCP resources. McpAuth handles OAuth for remote servers.
SkillTool / ToolSearchTool
src/tools/SkillTool/ + ToolSearchTool/
Execute skills within conversation. ToolSearch lazily loads deferred tool schemas to keep system prompt small.
TodoWriteTool / NotebookEditTool
src/tools/TodoWriteTool/ + NotebookEditTool/
Manage todo lists for tracking work. Edit Jupyter notebooks (add/edit/delete cells). Both always available.
Feature-Gated Tools
15+ tools behind bun:bundle flags
SleepTool (PROACTIVE/KAIROS), CronTools (AGENT_TRIGGERS), RemoteTrigger, MonitorTool, WorkflowTool (WORKFLOW_SCRIPTS), SnipTool (HISTORY_SNIP), WebBrowserTool, and more.
Anthropic-Internal Tools
USER_TYPE === 'ant'
REPLTool (sandboxed VM), ConfigTool (settings editor), TungstenTool, SuggestBackgroundPRTool. Excluded from external builds.
TOOL_ARCHITECTURE
Every tool implements the Tool interface from src/Tool.ts. The registry in tools.ts assembles the pool via getAllBaseTools(), applies feature gates, permission deny rules, and REPL mode filtering.
MCP tools are merged via assembleToolPool() which deduplicates by name, with built-ins taking precedence.
LLM Response (tool_use block)
│
├── Parse tool name + input JSON
│
├── Permission Check (ToolPermissionContext)
│ ├── Always-allow rules? ──→ Execute
│ ├── Always-deny rules? ──→ Reject
│ ├── Hook pre-checks? ──→ Evaluate
│ └── Prompt user? ──→ Wait for approval
│
├── Tool.execute(input, ToolUseContext)
│ ├── ToolUseContext provides:
│ │ ├── commands, tools, mcpClients
│ │ ├── abortController, readFileState
│ │ ├── getAppState / setAppState
│ │ ├── messages (conversation history)
│ │ └── agentId, agentType (for subagents)
│ │
│ └── Returns: ToolResult (text/image/error)
│
└── Feed result back to LLM → continue tool loop