Polyglot AST Symbol Extractor, Call Graph & Complexity Analyzer
analyze_ast_symbol_graphStatically parses TypeScript, Python, Rust, Go, or Move code to extract symbols, call edges, and complexity metrics for mapping functions and hotspots before refactoring.
Instructions
Static lexer and AST parser only (zero execution or evaluation): extracts imports, exports, classes, interfaces, and functions with line numbers, intra-file call edges, McCabe cyclomatic complexity, and Halstead volume across TypeScript, Python, Rust, Go, and Move. Use when mapping internal functions, call graphs, and complexity hotspots of a source file before refactoring; for analyzing cross-file import DAGs and circular dependencies, use audit_module_dependency_cycles instead. Read-only call (32 KB, 60 RPM): accepts 'source_text' (with enum defaults), uses '?demo=true' or L402 (20 sats); HTTP 400 if invalid.
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": {
"code": "<code>"
},
"name": "analyze_ast_symbol_graph"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Source code file content to parse for symbols and complexity metrics. | |
| language | No | Programming language grammar used for symbol extraction; defaults to 'typescript' when omitted. | |
| source_text | No | Alias for code: source code file content to parse. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| functions | Yes | Extracted functions with line number, cyclomatic_complexity, and outgoing calls. | |
| lines_of_code | Yes | Total line count of the analyzed source code. | |
| halstead_metrics | Yes | Halstead vocabulary_size, program_length, volume, and estimated_bugs. | |
| high_complexity_hotspots | Yes | Functions with McCabe cyclomatic complexity >= 8 flagged for refactoring. |