Skip to main content
Glama

Diogenes Context Compression, Code Patching & Deterministic Solver MCP

Polyglot AST Symbol Extractor, Call Graph & Complexity Analyzer

analyze_ast_symbol_graph
Read-onlyIdempotent

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 (75 sats); HTTP 400 if invalid.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoSource code file content to parse for symbols and complexity metrics.
languageNoProgramming language grammar used for symbol extraction; defaults to 'typescript' when omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionsYesExtracted functions with line number, cyclomatic_complexity, and outgoing calls.
lines_of_codeYesTotal line count of the analyzed source code.
halstead_metricsYesHalstead vocabulary_size, program_length, volume, and estimated_bugs.
high_complexity_hotspotsYesFunctions with McCabe cyclomatic complexity >= 8 flagged for refactoring.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / required
      Previous value: -[
      -  "code"
      -]New value: +[
      +  "source_text"
      +]
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare read-only/idempotent/non-destructive, but the description goes well beyond them: it clarifies the parser does zero execution or evaluation, states the 32 KB payload cap and 60 RPM rate limit, discloses demo/L402 payment options (75 sats), and names the HTTP 400 failure mode. This is exactly the operational context structured fields cannot carry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose and scope, then usage/routing, then operational constraints. It is dense but every clause carries information; the only minor cost is the packed parenthetical operational block that takes a second read.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a stateless parser with a full output schema, the description supplies everything needed: scope, supported languages, usage conditions, sibling routing, resource limits, payment mode, and error behavior. Return values are correctly left to the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents both parameters, making 3 the baseline. The description mentions 'source_text' and 'enum defaults', which is mildly useful but also slightly inconsistent with the schema (property is named 'code' while the required key is 'source_text'), so it adds no reliable meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (static AST parse / symbol extraction) and enumerates exactly what is extracted: imports, exports, classes, interfaces, functions, call edges, cyclomatic complexity, Halstead volume, across five named languages. It also distinguishes itself from the sibling audit_module_dependency_cycles, so an agent can route without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit when-to-use ('mapping internal functions, call graphs, and complexity hotspots of a source file before refactoring') and a named alternative for the adjacent case ('for analyzing cross-file import DAGs and circular dependencies, use audit_module_dependency_cycles instead'). Both the condition and the counter-condition are spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources