find or grep via BashTool.
GlobTool
Find files by name or path pattern
GrepTool
Search file contents with regex (powered by ripgrep)
ToolSearchTool
Discover which built-in tool to use for a task
GlobTool
Finds files whose paths match a glob pattern. Results are sorted by modification time (most recently changed first) to surface relevant files quickly. Tool name:GlobRead-only: yes
Concurrency-safe: yes
Destructive: no
Parameters
The glob pattern to match file paths against. Supports
*, **, ?, and brace expansions, e.g. "**/*.ts", "src/**/*.{ts,tsx}", "*.config.js".Directory to search in. Defaults to the current working directory when omitted. Must be a valid directory path — do not pass
"undefined" or "null".Return value
Relative paths (relative to the current working directory) of matching files.
Total number of files returned.
true when results were capped (default cap: 100 files). Use a more specific pattern or path to narrow the search.Wall-clock time to execute the search in milliseconds.
Usage examples
Find all TypeScript files in a project:GrepTool
Searches file contents for a regular expression pattern. Internally uses ripgrep (rg) for high performance, with automatic exclusion of VCS directories (.git, .svn, .hg, .bzr, .jj, .sl).
Tool name: SearchRead-only: yes
Concurrency-safe: yes
Destructive: no
Parameters
A regular expression pattern to search for. Full ripgrep regex syntax is supported.
File or directory to search in (
rg PATH). Defaults to the current working directory.Glob pattern to filter which files are searched, e.g.
"*.js" or "*.{ts,tsx}". Maps to rg --glob.Controls the format of results:
"files_with_matches"— list of file paths that contain at least one match (default)"content"— matched lines with optional surrounding context lines"count"— number of matches per file
Lines of context before each match (
rg -B). Only used when output_mode is "content".Lines of context after each match (
rg -A). Only used when output_mode is "content".Lines of context before and after each match (
rg -C). Alias for context. Overrides -B/-A when specified. Only used when output_mode is "content".Alias for
-C. Lines of symmetric context around each match.Show line numbers in
"content" mode output (rg -n).Case-insensitive search (
rg -i).Restrict search to a ripgrep file type (
rg --type). Examples: "js", "py", "rust", "go", "java". More efficient than glob for standard language types.Limit output to the first N lines/entries, equivalent to
| head -N. Pass 0 for unlimited (use sparingly — large results consume significant context).Skip the first N lines/entries before applying
head_limit. Equivalent to | tail -n +N | head -N. Use together with head_limit for pagination.Enable multiline mode where
. matches newlines and patterns can span lines (rg -U --multiline-dotall).Return value
The output mode that was used:
"files_with_matches", "content", or "count".Matching file paths (relative to CWD). Populated for
"files_with_matches" mode. Sorted by most recently modified.Number of files returned.
Matched output as a string. Populated for
"content" and "count" modes.Number of output lines. Populated for
"content" mode.Total match count across all files. Populated for
"count" mode.The
head_limit that was applied, set only when truncation actually occurred.The
offset that was applied, set when offset > 0.ripgrep under the hood
GrepTool delegates to ripgrep (rg) and mirrors its semantics closely. Key behaviours:
- Lines are capped at 500 characters to avoid bloating results with minified files or base64 blobs.
- VCS directories are excluded automatically via
--glob !.git --glob !.svnetc. - Permission-based ignore patterns from Claude Code settings are forwarded as additional
--glob !...rules. - In
"files_with_matches"mode, results are sorted by file modification time beforehead_limitis applied.
Usage examples
Find all files containing a React hook:ToolSearchTool
A meta-tool that searches the descriptions of all available built-in tools to help the model find the right tool for a given task. Useful when an unfamiliar task might be covered by a lesser-known built-in. Tool name:ToolSearchRead-only: yes
Concurrency-safe: yes
Destructive: no
Parameters
A natural-language description of the task you want to accomplish. The tool matches against the
searchHint field registered on each built-in tool.Return value
An ordered list of tool names and their descriptions ranked by relevance toquery.