astgrep_search
Search code patterns using AST matching across specified paths for multiple programming languages, with adjustable strictness and context lines, integrated into the MCP-REPL server.
Instructions
Pattern-based code search using ast-grep - find code patterns using AST matching
Input Schema
Name | Required | Description | Default |
---|---|---|---|
context | No | Number of context lines to include | |
language | No | Programming language (javascript, typescript, python, etc.) | |
outputFormat | No | Output format | |
paths | No | Specific paths to search (defaults to current directory) | |
pattern | Yes | AST pattern to search for (e.g., 'function $NAME($$$ARGS) { $$$ }') | |
strictness | No | Pattern matching strictness level | |
workingDirectory | No | Optional working directory for the operation (defaults to server working directory) |
Input Schema (JSON Schema)
{
"properties": {
"context": {
"description": "Number of context lines to include",
"type": "number"
},
"language": {
"description": "Programming language (javascript, typescript, python, etc.)",
"type": "string"
},
"outputFormat": {
"description": "Output format",
"enum": [
"compact",
"pretty"
],
"type": "string"
},
"paths": {
"description": "Specific paths to search (defaults to current directory)",
"items": {
"type": "string"
},
"type": "array"
},
"pattern": {
"description": "AST pattern to search for (e.g., 'function $NAME($$$ARGS) { $$$ }')",
"type": "string"
},
"strictness": {
"description": "Pattern matching strictness level",
"enum": [
"cst",
"smart",
"ast",
"relaxed"
],
"type": "string"
},
"workingDirectory": {
"description": "Optional working directory for the operation (defaults to server working directory)",
"type": "string"
}
},
"required": [
"pattern"
],
"type": "object"
}