grep
Search cached files for exact strings or regex patterns, returning matches with line numbers. Use for symbols, imports, or error strings in codebases.
Instructions
Search cached files for an exact string or regex, with line numbers.
This is the cache-only exact-search tool. It is intentionally closer to "ripgrep on cached content" than to live filesystem search.
Routing rules:
Use
grepfor exact symbols, literals, imports, error strings, or regex.Use
searchfor semantic or fuzzy intent.Seed candidate files with
batch_readfirst; empty results may simply mean the relevant files are not cached yet.
Usage guidance:
Set
fixed_string=truefor literals containing regex metacharacters.Add
pathto limit scope to one file, a suffix, or a glob.Add
context_lines=2or3when surrounding code matters.
Args:
pattern: Regex pattern, or a literal if fixed_string=true.
path: Optional exact path, suffix, or glob filter.
fixed_string: Treat pattern as a literal instead of regex.
case_sensitive: Whether matching is case-sensitive.
context_lines: Number of context lines to include around matches.
max_matches: Maximum total matches across all files.
max_files: Maximum number of files to return.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | ||
| path | No | ||
| fixed_string | No | ||
| case_sensitive | No | ||
| context_lines | No | ||
| max_matches | No | ||
| max_files | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| truncated | No | ||
| pattern | No | ||
| path | No | ||
| total_matches | No | ||
| files_matched | No | ||
| files | No | ||
| fixed_string | No | ||
| case_sensitive | No | ||
| context_lines | No |