grep
Search the project's indexed files by literal string or regex to locate log messages, config keys, or error traces, while skipping binaries and respecting .gitignore.
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.
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. Required with linked worktrees; subagents must pass their own worktree root on every 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. |