Tools System Architecture
Overview
Tools are how Claude interacts with the world. Every action - reading files, running commands, searching code - is a tool. The tool system is modular, type-safe, and extensible.
Plain text
Shared from "Claude-Code" on Inkdown
Tools are how Claude interacts with the world. Every action - reading files, running commands, searching code - is a tool. The tool system is modular, type-safe, and extensible.
| File | Purpose |
|---|---|
Tool.ts | Base Tool type definitions |
tools.ts | Tool registry and getAllBaseTools() |
tools/[Name]Tool/[Name]Tool.ts | Individual tool implementations |
tools/[Name]Tool/prompt.ts | Tool descriptions for LLM |
tools/[Name]Tool/UI.tsx | Tool-specific UI components |
tools/[Name]Tool/constants.ts | Tool constants |
Every tool implements this interface:
| Tool | Purpose | Permission |
|---|---|---|
FileReadTool | Read file contents | Background |
FileWriteTool | Create new files | Dangerous |
FileEditTool | Edit existing files | Dangerous |
GlobTool | Find files by pattern | Background |
GrepTool | Search file contents | Background |
| Tool | Purpose | Permission |
|---|---|---|
BashTool | Run shell commands | Dangerous |
PowerShellTool | Windows PowerShell | Dangerous |
REPLTool | Interactive REPL (ant-only) | Dangerous |
| Tool | Purpose |
|---|---|
LSPTool | Language server operations |
GrepTool | Text search |
GlobTool | File discovery |
TungstenTool | Internal symbol search |
| Tool | Purpose |
|---|---|
AgentTool | Spawn sub-agents |
TaskCreateTool | Create background tasks |
TaskStopTool | Kill tasks |
TaskGetTool | Get task output |
SendMessageTool | Message between agents |
| Tool | Purpose |
|---|---|
WebSearchTool | Search the web |
WebFetchTool | Fetch URLs |
AskUserQuestionTool | Prompt user for input |
NotebookEditTool | Edit Jupyter notebooks |
TodoWriteTool | Manage todo lists |
ConfigTool | Change settings |
| Tool | Purpose |
|---|---|
EnterPlanModeTool | Start planning mode |
ExitPlanModeTool | Exit planning mode |
EnterWorktreeTool | Create git worktree |
ExitWorktreeTool | Remove git worktree |
External tools via Model Context Protocol:
Tools can report progress:
Tools can render custom UI during execution:
Reading, writing, searching, even asking the user - all tools.
Zod schemas provide both type safety and runtime validation.
Tools self-declare their danger level. System respects this.
Long operations can stream progress for better UX.
Complex tools can render their own UI components.
External tools integrate seamlessly via MCP.