Search: Dozens of Tools, Pulled In on Demand
Claude Code has 40 built-in tools (each corresponding to a subdirectory under src/tools/), grouped by function:
| Group | Tools | Description |
|---|---|---|
| File operations | FileReadTool, FileWriteTool, FileEditTool | Read, write, edit files |
| Code search | GlobTool, GrepTool | File name matching, content search |
| Command execution | BashTool, PowerShellTool | Execute shell commands (cross-platform) |
| Agent collaboration | AgentTool, SendMessageTool, TeamCreateTool, TeamDeleteTool | Spawn sub-agents, team collaboration |
| Task management | TaskCreateTool, TaskGetTool, TaskListTool, TaskOutputTool, TaskStopTool, TaskUpdateTool | Full lifecycle management of background tasks |
| Plan mode | EnterPlanModeTool, ExitPlanModeTool | Plan only, don't execute |
| Sandbox isolation | EnterWorktreeTool, ExitWorktreeTool | Enter/exit git worktree isolated environment |
| MCP protocol | MCPTool, McpAuthTool, ListMcpResourcesTool, ReadMcpResourceTool | Connect to external MCP servers and their resources |
| Network | WebFetchTool, WebSearchTool | Fetch web pages, search engine queries |
| Notebook | NotebookEditTool | Edit Jupyter Notebooks |
| Dev tooling | REPLTool, LSPTool, ToolSearchTool, SkillTool | Batch tool calls, language service, tool search, skill loading |
| Interaction & config | AskUserQuestionTool, ConfigTool, TodoWriteTool | Ask user questions, read/write config, task lists |
| Scheduling | ScheduleCronTool, RemoteTriggerTool, SleepTool | Scheduled tasks, remote triggers, waits |
| Internal tools | BriefTool, SyntheticOutputTool | Internal summary generation, synthetic output (not exposed externally) |
Loading all of them into Claude's context on the first turn would waste tokens. shouldDefer and alwaysLoad solve this:
// src/Tool.ts
readonly shouldDefer?: boolean
// When true: only the tool's name is sent — no full parameter schema
// Claude must call ToolSearch first to get the full definition before calling the tool
readonly alwaysLoad?: boolean
// When true: even if lazy-loading is enabled globally, this tool always includes its full schema
// Suitable for tools Claude needs in the first turn (like ToolSearch itself)
This mechanism implements "on-demand loading": common tools (Bash, FileEdit) always load; rarely used tools (e.g. CronCreate) are hidden first — Claude uses ToolSearch with keywords to retrieve the full definition.