ast_find_pattern
ast_find_patternSearch TypeScript and JavaScript code by AST pattern matching instead of text, returning typed matches with file, line, column ranges, and captured variables.
Instructions
Code-intelligence tool for structural pattern search: run one ast-grep pattern against every fresh indexed TypeScript / TSX / JavaScript / JSX file and return typed matches (file, line range, column range, matched text, captured metavariables). Ambiguous TSX/JSX snippets that start with {, [, or < retry with an auto-anchored const _ = ... parser context when the original pattern returns zero matches, and patternAttempts / match patternVariant report which form matched. Reef-backed freshness guard skips stale/deleted/unknown indexed files so old AST rows do not become phantom matches; set MAKO_REEF_BACKED=legacy for the one-release rollback path. Read-only; never edits files. Use when text/FTS search is too noisy for structural queries (e.g. console.log($X), await supabase.rpc($NAME), useEffect($FN, [])).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | No | ||
| projectRef | No | ||
| pattern | Yes | ||
| captures | No | ||
| languages | No | ||
| pathGlob | No | ||
| maxMatches | No | ||
| maxFiles | No | ||
| excludeAcknowledgedCategory | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| toolName | Yes | ||
| projectId | Yes | ||
| pattern | Yes | ||
| languagesApplied | Yes | ||
| filesScanned | Yes | ||
| patternAttempts | Yes | ||
| matches | Yes | ||
| acknowledgedCount | Yes | ||
| reefFreshness | Yes | ||
| reefExecution | Yes | ||
| truncated | Yes | ||
| warnings | Yes | ||
| _hints | Yes |