Claude Code's built-in tools for file operations, shell commands, web, and more.
type ToolInputSchemas =
| AgentInput | BashInput | BashOutputInput | FileReadInput
| FileEditInput | FileWriteInput | GlobInput | GrepInput
| WebFetchInput | WebSearchInput | TodoWriteInput | NotebookEditInput
| McpInput | ListMcpResourcesInput | ReadMcpResourceInput
| KillShellInput | ExitPlanModeInput | AskUserQuestionInput;// Read
interface FileReadInput {
file_path: string;
offset?: number;
limit?: number;
}
// Edit (string replacement)
interface FileEditInput {
file_path: string;
old_string: string;
new_string: string;
replace_all?: boolean;
}
// Write
interface FileWriteInput {
file_path: string;
content: string;
}// Glob (find files)
interface GlobInput {
pattern: string;
path?: string;
}
// Grep (search contents)
interface GrepInput {
pattern: string;
path?: string;
glob?: string;
output_mode?: 'content' | 'files_with_matches' | 'count';
'-B'?: number;
'-A'?: number;
'-C'?: number;
'-n'?: boolean;
'-i'?: boolean;
type?: string;
head_limit?: number;
offset?: number;
multiline?: boolean;
}// Bash (execute commands)
interface BashInput {
command: string;
timeout?: number;
description?: string;
run_in_background?: boolean;
dangerouslyDisableSandbox?: boolean;
}
// BashOutput (read background shell)
interface BashOutputInput {
bash_id: string;
filter?: string;
}
// KillShell (terminate background)
interface KillShellInput {
shell_id: string;
}// WebFetch (fetch & process)
interface WebFetchInput {
url: string;
prompt: string;
}
// WebSearch
interface WebSearchInput {
query: string;
allowed_domains?: string[];
blocked_domains?: string[];
}// Task tool (invoke subagents)
interface AgentInput {
description: string;
prompt: string;
subagent_type: string;
model?: 'sonnet' | 'opus' | 'haiku';
resume?: string;
}// NotebookEdit (Jupyter)
interface NotebookEditInput {
notebook_path: string;
cell_id?: string;
new_source: string;
cell_type?: 'code' | 'markdown';
edit_mode?: 'replace' | 'insert' | 'delete';
}
// TodoWrite (task management)
interface TodoWriteInput {
todos: Array<{
content: string;
status: 'pending' | 'in_progress' | 'completed';
activeForm: string;
}>;
}
// ListMcpResources
interface ListMcpResourcesInput {
server?: string;
}
// ReadMcpResource
interface ReadMcpResourceInput {
server: string;
uri: string;
}
// McpInput (generic)
interface McpInput {
[k: string]: unknown;
}
// ExitPlanMode
interface ExitPlanModeInput {
[k: string]: unknown;
}
// AskUserQuestion
interface AskUserQuestionInput {
questions: Array<{
question: string;
header: string;
options: Array<{label: string; description: string}>;
multiSelect: boolean;
}>;
answers?: {[k: string]: string};
}// Specific tools
{tools: ['Read', 'Grep', 'Glob', 'Bash']}
// All Claude Code tools
{tools: {type: 'preset', preset: 'claude_code'}}
// Whitelist
{allowedTools: ['Read', 'Write', 'Edit']}
// Blacklist
{
tools: {type: 'preset', preset: 'claude_code'},
disallowedTools: ['Bash', 'WebFetch', 'WebSearch']
}// Agent uses tools automatically
const result = query({
prompt: 'Read main.ts, find TODOs, update README',
options: {tools: ['Read', 'Grep', 'Write']}
});
// 1. Read main.ts
// 2. Grep for TODOs
// 3. Write READMEconst result = query({
prompt: 'Find all TypeScript files importing React',
options: {tools: ['Glob', 'Grep']}
});
// 1. Glob: *.ts, *.tsx
// 2. Grep: React importsconst result = query({
prompt: 'Install dependencies and run tests',
options: {
tools: ['Bash'],
sandbox: {enabled: true, autoAllowBashIfSandboxed: true}
}
});
// 1. Bash: npm install
// 2. Bash: npm testconst result = query({
prompt: 'Search for TypeScript best practices',
options: {tools: ['WebSearch', 'WebFetch']}
});
// 1. WebSearch: find results
// 2. WebFetch: fetch & analyzeconst result = query({
prompt: 'Have architect analyze codebase',
options: {
tools: ['Read', 'Grep', 'Glob', 'Agent'],
agents: {
'architect': {
description: 'Analyzes architecture',
tools: ['Read', 'Grep', 'Glob'],
prompt: 'You are an architecture expert...',
model: 'opus'
}
}
}
});
// Agent tool invokes 'architect' subagent// Read-only
{allowedTools: ['Read', 'Grep', 'Glob']}
// No shell
{
tools: {type: 'preset', preset: 'claude_code'},
disallowedTools: ['Bash', 'WebFetch', 'WebSearch']
}
// Minimal
{tools: ['Grep', 'Glob']}