project_grep
Regex-search deployed authored source — every static source file and server function — and get back file:line matches in one call. The existing per-project call remains unchanged. Platform admins may instead pass scope:"live" (and omit project_id) to search every project currently serving production traffic (projects.status = 'deployed'). Release-pinned projects read their immutable release; other projects read their prod-slot authored source. Fleet responses report projects scanned/searched/skipped by reason, projects with no prod function script, and whether results were truncated. Every fleet hit carries the stable file/path/file_path, line/line_number, col/column, and text/matched_line compatibility fields.
pattern is a regular expression (not a literal substring). glob optionally scopes the search: a glob with no slash matches by filename (*.tsx → every .tsx file), one with a slash matches the path (api/** → just that folder).
Example:
{ "project_id": "my-saas", "pattern": "createClient\\(", "glob": "src/**" }
// Returns: {
// project_id, env: "prod",
// matches: [
// { path: "src/lib/db.ts", line: 3, col: 18, text: "export const db = createClient(url, key)" }
// ],
// truncated: false, files_searched: 24
// }Returns at most max_results matches (default 100, max 1000), capped per file too; truncated: true means a cap clipped the results — narrow the pattern or glob. Searches the live prod source by default. Explicit env: "dev" requires hosted preview access for signed-in accounts on every plan.
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": "project_grep"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Which environment's source to search. Defaults to "prod" (live). Explicit "dev" requires hosted preview access for signed-in accounts on every plan. | |
| glob | No | Optional path filter. No-slash globs match the filename ("*.ts"); slashed globs match the path ("api/**", "src/components/*.tsx"). | |
| scope | No | Admin-only. Search every live project instead of one project; project_id is omitted. | |
| pattern | Yes | A regular expression to search for (e.g. "export function \\w+", "TODO|FIXME"). Backreferences, lookaround, and non-ASCII characters inside [...] with case_insensitive are not supported; a search that runs too long returns SEARCH_PATTERN_TOO_SLOW (simplify the pattern or search plain text). | |
| preview_id | No | Exact current candidate of preview_session_id. Both fields are required together. | |
| project_id | No | Project ID, slug, subdomain, or 'default'. | |
| max_results | No | Cap on total matches returned. Default 100, max 1000. | |
| case_insensitive | No | Match case-insensitively. Default false. | |
| preview_session_id | No | Exact open preview session paired with preview_id and env:"dev". It does not fall back to another source. |