ast_context_search
Extract the enclosing function, method, or class scope around a symbol in a source file, with optional full-body output up to 120 lines for precise code context.
Instructions
Extract enclosing function/method/class scope around a symbol inside one file (supports full_scope).
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": {
"file_path": "<file_path>",
"pattern": "<pattern>"
},
"name": "ast_context_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Symbol or keyword to locate | |
| file_path | Yes | Absolute path to source file | |
| full_scope | No | Return full enclosing function/method/class body up to 120 lines (default: false) | |
| context_radius | No | Lines before/after match when full_scope=false (default: 4) |