grep
Search files in a project using regex patterns. Supports glob filtering, case-insensitive matching, context lines, and output modes (paths, content with line numbers, or match counts). Results limited to 250 by default; use glob to narrow searches.
Instructions
Regex content search across a project's files. Postgres-backed, scoped to one project, with glob filtering.
Three output modes:
files_with_matches (default) — list paths containing a match
content — matching lines with optional context and line numbers
count — per-file match counts + total
Default head_limit is 250 to prevent context blowups on broad patterns. Use glob to narrow by path (e.g. 'api//*.js', 'public//.html'). Regex uses Postgres syntax (~ / ~). Invalid or catastrophic patterns error out via a 2s statement timeout — simplify the pattern if that happens.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Project ID (e.g. proj_a8Kq7fR2xZ) | |
| pattern | Yes | Regex pattern to search for | |
| glob | No | Path filter glob (e.g. 'api/**/*.js', 'public/*.html') | |
| output_mode | No | Output format | |
| -i | No | Case-insensitive match | |
| -n | No | Show line numbers in content mode (default true) | |
| context | No | Lines of context before/after each match (content mode) | |
| head_limit | No | Max results to return (default 250, max 1000) |