Skip to content

11 - Tool Descriptions

Sources: Various tools/*/prompt.ts files


Source: tools/FileEditTool/prompt.ts

Performs exact string replacements in files.
Usage:
- You must use your Read tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix.
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
- The edit will FAIL if old_string is not unique in the file. Either provide a larger string with more surrounding context or use replace_all.
- Use replace_all for replacing and renaming strings across the file.

Internal users get additional guidance:

- Use the smallest old_string that's clearly unique — usually 2-4 adjacent lines is sufficient. Avoid including 10+ lines of context when less uniquely identifies the target.

Source: tools/FileWriteTool/prompt.ts

Writes a file to the local filesystem.
Usage:
- This tool will overwrite the existing file if there is one at the provided path.
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
- Prefer the Edit tool for modifying existing files — it only sends the diff.
- NEVER create documentation files (*.md) or README files unless explicitly requested by the User.
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.

Source: tools/FileReadTool/prompt.ts

Reads a file from the local filesystem. You can access any file directly by using this tool.
Usage:
- The file_path parameter must be an absolute path, not a relative path
- By default, it reads up to 2000 lines starting from the beginning of the file
- When you already know which part of the file you need, only read that part.
- Results are returned using cat -n format, with line numbers starting at 1
- This tool allows Claude Code to read images (PNG, JPG, etc). When reading an image file the contents are presented visually.
- This tool can read PDF files. For large PDFs (>10 pages), you MUST provide the pages parameter.
- This tool can read Jupyter notebooks (.ipynb files).
- This tool can only read files, not directories.

Source: tools/GlobTool/prompt.ts

- Fast file pattern matching tool that works with any codebase size
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
- Returns matching file paths sorted by modification time
- Use this tool when you need to find files by name patterns
- When doing an open ended search that may require multiple rounds, use the Agent tool instead

Source: tools/GrepTool/prompt.ts

A powerful search tool built on ripgrep
Usage:
- ALWAYS use Grep for search tasks. NEVER invoke `grep` or `rg` as a Bash command.
- Supports full regex syntax
- Filter files with glob parameter or type parameter
- Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts
- Use Agent tool for open-ended searches requiring multiple rounds
- Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping
- Multiline matching: By default patterns match within single lines only. For cross-line patterns, use multiline: true

Source: tools/WebSearchTool/prompt.ts

Key rule:

CRITICAL REQUIREMENT - MANDATORY:
After answering the user's question, you MUST include a "Sources:" section listing all relevant URLs as markdown hyperlinks. This is MANDATORY - never skip this.

Source: tools/WebFetchTool/prompt.ts

IMPORTANT: Prefer MCP-provided web fetch tools if available.
- HTTP URLs auto-upgraded to HTTPS
- Results cached for 15 minutes
- When URL redirects to different host, create new request with redirect URL
- For GitHub URLs, prefer gh CLI via Bash

Tool descriptions follow a consistent pattern:

  1. One-line capability statement
  2. Usage section with prioritized rules (MUST/NEVER/IMPORTANT)
  3. Edge cases and gotchas
  4. Relationship to other tools (preferences and alternatives)