GrepTool
Searches file contents using ripgrep and returns results sorted by the modification time of matching files (most recently modified first). Supports full regex syntax, context lines, file type filters, and multiple output modes.Parameters
The regular expression to search for in file contents. Supports full regex syntax (e.g.
"log.*Error", "function\s+\w+").File or directory to search. Defaults to the current working directory.
Glob pattern to filter which files are searched (e.g.
"*.ts", "*.{ts,tsx}").Controls the format of results:
"files_with_matches"(default) — return the paths of files that contain at least one match"content"— return the matching lines with optional context"count"— return match counts per file
Number of lines to show before and after each match (equivalent to
rg -C). Only used when output_mode is "content".Lines of context before each match (equivalent to
rg -B). Only used when output_mode is "content".Lines of context after each match (equivalent to
rg -A). Only used when output_mode is "content".Case-insensitive search. Defaults to
false.Include line numbers in
"content" mode output. Defaults to true.Restrict search to a ripgrep file type (e.g.
"ts", "py", "go"). More efficient than glob for standard language types.Maximum number of results to return (equivalent to
| head -N). Defaults to 250. Pass 0 for unlimited results.Skip the first N results before applying
head_limit (equivalent to | tail -n +N). Defaults to 0.Enable multiline mode so
. matches newlines and patterns can span lines. Defaults to false.Returns
Depends onoutput_mode:
"files_with_matches": list of relative file paths with at least one match"content": matching lines (and context lines if requested) as a string"count": per-file match counts
Examples
Find all TypeScript files that export a function nameduseAuth:
GlobTool
Finds files by name using glob patterns. Results are sorted by modification time (most recently modified first).Parameters
The glob pattern to match file paths against (e.g.
"**/*.ts", "src/**/*.test.tsx", "*.config.{js,ts}").The directory to search in. Defaults to the current working directory. Must be a valid directory path if provided—do not pass
"undefined" or "null".