Skip to main content
Every tool lives in src/tools/<ToolName>/ as a self-contained module. Tools are registered in src/tools.ts and invoked by the Query Engine during LLM tool-call loops. Each tool defines:
  • Input schema — Zod-validated parameters
  • Permission model — What requires user approval
  • Execution logic — The tool’s implementation
  • UI components — Terminal rendering for invocation and results
  • Concurrency safety — Whether it can run in parallel

Tool definition pattern

export const MyTool = buildTool({
  name: 'MyTool',
  aliases: ['my_tool'],
  description: 'What this tool does',
  inputSchema: z.object({
    param: z.string(),
  }),
  async call(args, context, canUseTool, parentMessage, onProgress) {
    // Execute and return { data: result, newMessages?: [...] }
  },
  async checkPermissions(input, context) { /* Permission checks */ },
  isConcurrencySafe(input) { /* Can run in parallel? */ },
  isReadOnly(input) { /* Non-destructive? */ },
  prompt(options) { /* System prompt injection */ },
  renderToolUseMessage(input, options) { /* UI for invocation */ },
  renderToolResultMessage(content, progressMessages, options) { /* UI for result */ },
})
Each tool follows a standard directory layout:
src/tools/MyTool/
├── MyTool.ts        # Main implementation
├── UI.tsx           # Terminal rendering
├── prompt.ts        # System prompt contribution
└── utils.ts         # Tool-specific helpers

File system tools

ToolDescriptionRead-only
FileReadToolRead file contents (text, images, PDFs, notebooks). Supports line rangesYes
FileWriteToolCreate or overwrite filesNo
FileEditToolPartial file modification via string replacementNo
GlobToolFind files matching glob patterns (e.g. **/*.ts)Yes
GrepToolContent search using ripgrep (regex-capable)Yes
NotebookEditToolEdit Jupyter notebook cellsNo
TodoWriteToolWrite to a structured todo/task fileNo

Shell & execution tools

ToolDescriptionRead-only
BashToolExecute shell commands in bashNo
PowerShellToolExecute PowerShell commands (Windows)No
REPLToolRun code in a REPL session (Python, Node, etc.)No

Agent & orchestration tools

ToolDescriptionRead-only
AgentToolSpawn a sub-agent for complex tasksNo
SendMessageToolSend messages between agentsNo
TeamCreateToolCreate a team of parallel agentsNo
TeamDeleteToolRemove a team agentNo
EnterPlanModeToolSwitch to planning mode (no execution)No
ExitPlanModeToolExit planning mode, resume executionNo
EnterWorktreeToolIsolate work in a git worktreeNo
ExitWorktreeToolExit worktree isolationNo
SleepToolPause execution (proactive mode)Yes
SyntheticOutputToolGenerate structured outputYes

Task management tools

ToolDescriptionRead-only
TaskCreateToolCreate a new background taskNo
TaskUpdateToolUpdate a task’s status or detailsNo
TaskGetToolGet details of a specific taskYes
TaskListToolList all tasksYes
TaskOutputToolGet output from a completed taskYes
TaskStopToolStop a running taskNo

Web tools

ToolDescriptionRead-only
WebFetchToolFetch content from a URLYes
WebSearchToolSearch the webYes

MCP (Model Context Protocol) tools

ToolDescriptionRead-only
MCPToolInvoke tools on connected MCP serversVaries
ListMcpResourcesToolList resources exposed by MCP serversYes
ReadMcpResourceToolRead a specific MCP resourceYes
McpAuthToolHandle MCP server authenticationNo
ToolSearchToolDiscover deferred/dynamic tools from MCP serversYes

Integration tools

ToolDescriptionRead-only
LSPToolLanguage Server Protocol operations (go-to-definition, find references, etc.)Yes
SkillToolExecute a registered skillVaries

Scheduling & triggers

ToolDescriptionRead-only
ScheduleCronToolCreate a scheduled cron triggerNo
RemoteTriggerToolFire a remote triggerNo

Utility tools

ToolDescriptionRead-only
AskUserQuestionToolPrompt the user for input during executionYes
BriefToolGenerate a brief/summaryYes
ConfigToolRead or modify Claude Code configurationNo

Permission model

Every tool invocation passes through the permission system at src/hooks/toolPermission/. Each tool implements checkPermissions() returning { granted: boolean, reason?, prompt? }.

Permission modes

ModeBehavior
defaultPrompt the user for each potentially destructive operation
planShow the full execution plan, ask once for batch approval
bypassPermissionsAuto-approve all operations (dangerous — for trusted environments only)
autoML-based classifier automatically decides (experimental)

Permission rule syntax

Rules use wildcard patterns to match tool invocations:
Bash(git *)           # Allow all git commands without prompt
Bash(npm test)        # Allow 'npm test' specifically
FileEdit(/src/*)      # Allow edits to anything under src/
FileRead(*)           # Allow reading any file
bypassPermissions mode auto-approves all tool invocations, including destructive file writes and shell commands. Only use it in fully trusted, sandboxed environments.

Tool presets

Tools are grouped into presets in src/tools.ts for different contexts. For example, read-only tools are used for code review workflows while the full toolset is enabled for active development sessions.
See Architecture for how tools fit into the overall pipeline, and Configuration for managing tool permission rules.

Build docs developers (and LLMs) love