grep_files
Search file contents using regex patterns to locate matching lines, file paths, and line numbers. Optionally filter by file glob and include surrounding context for precise results.
Instructions
Search file contents for a regex pattern, like grep/ripgrep. Returns matching lines with file paths and line numbers. Optionally filter by file glob (e.g. '*.py') and include context lines. Skips binary files and .git, node_modules, .venv, pycache.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | File or directory to search in (default: current directory). | . |
| include | No | Glob filter for file names (e.g. '*.py', '*.ts'). Empty = all files. | |
| pattern | Yes | Regex pattern to search for (Python re syntax). | |
| max_results | No | Maximum matching lines to return (1–500, default 50). | |
| context_lines | No | Lines of context before and after each match (0–10, default 0). |