grep
Search indexed project files by literal string or regular expression to find log messages, config keys, or error text.
Instructions
Fast literal or regex string search across the project's indexed file set. Use this for log-message lookups, config-key searches, error-message tracing, or any time you know the exact characters you want to find. Use 'search' instead for semantic intent queries. Skips binary files; respects .gitignore via the indexed walker.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pattern": "<pattern>"
},
"name": "grep"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| glob | No | Optional file glob filter, e.g. "src/**/*.ts" or "*.md". Comma-separated for multiple. | |
| root | No | Absolute project root. Omit only where this session started; required elsewhere and on every subagent call. | |
| regex | No | Treat pattern as a line-based regular expression (set true for A|B alternation). Default: false, literal match. | |
| pattern | Yes | Literal string to search for (or regex when regex=true). | |
| target_path | No | Optional subdirectory to scope the search. | |
| context_chars | No | Character window within the matched line; surrounding lines are clipped to this width. 40–400, default: 160. Use context_lines for nearby lines. | |
| context_lines | No | Lines before and after each match (0–10, default: 0). Overlapping ranges are deduplicated; L<line>- marks context, L<line>:<column> marks a hit. | |
| case_sensitive | No | Match case-sensitively. Default: false. | |
| max_file_bytes | No | Skip files larger than this (bytes). Default: 1000000. | |
| max_total_matches | No | Max total matches across all files. Default: 200. | |
| max_matches_per_file | No | Max matches per file. Default: 10. |