extract_code_context
Parse source files using AST to extract targeted code context and relevant imports, optimizing token usage for AI-based code analysis and assistance. Supports TypeScript, JavaScript, Python, Go, and Rust.
Instructions
Extract minimal code context from files using AST parsing
Input Schema
Name | Required | Description | Default |
---|---|---|---|
filePath | Yes | Path to the source file | |
includeImports | No | Whether to include relevant imports | |
maxTokens | No | Maximum tokens to return | |
targetSymbols | No | Specific symbols/functions to extract context for |
Input Schema (JSON Schema)
{
"properties": {
"filePath": {
"description": "Path to the source file",
"type": "string"
},
"includeImports": {
"default": true,
"description": "Whether to include relevant imports",
"type": "boolean"
},
"maxTokens": {
"default": 1000,
"description": "Maximum tokens to return",
"type": "number"
},
"targetSymbols": {
"description": "Specific symbols/functions to extract context for",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"filePath"
],
"type": "object"
}