AST Structural Search
ast_searchIdentify code patterns by matching abstract syntax trees, not raw text. Use $VAR for single nodes and $$$ for sequences; ignores comments and strings.
Instructions
Tree-sitter AST structural search via ast-grep. Matches real syntax trees, not text — so patterns can never match inside strings or comments. Use $VAR for one node, $$$ for many. Example: 'try { $$$ } catch ($E) { }'
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": {
"path": "<path>",
"pattern": "<pattern>"
},
"name": "ast_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | ts | |
| path | Yes | Absolute path to the repository root | |
| pattern | Yes | ast-grep pattern, e.g. 'useEffect($$$)' or '$X as any' |