Skip to main content
Glama

trace_symbol_call_chain

Trace a function's full call chain across the codebase AST, recursively finding upstream callers and downstream callees to render an execution tree and Mermaid diagram.

Instructions

Traces deep execution paths across the codebase AST. Recursively discovers upstream callers (who calls symbol_name) and downstream callees (what symbol_name calls) up to max_depth, rendering an execution tree and Mermaid call diagram.

Behavior:

  • Read-only: Recursively traverses AST function call expressions; does not modify source code.

  • Idempotent: Deterministic call graph traversal.

  • 100% Offline: Local AST analysis without external services.

Usage Guidelines:

  • When to use: Run when debugging execution flows, tracing data paths into a function, or seeing everything a complex method calls recursively.

  • Sibling Routing: For quick single-symbol blast radius scoring (0-100), use 'analyze_change_impact'. For module-level import relations, use 'query_module_dependencies'.

Returns: Markdown report containing recursive ASCII execution tree, caller/callee counts, and copy-pasteable Mermaid flowchart syntax.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_depthNoMaximum recursion depth for the call graph traversal (default: 3).
symbol_nameYesExact function or method name to trace across the codebase call graph.
project_rootNoRoot directory of the repository (default: current directory)..

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.1
    • addedInput schema / properties / max_depth / description
      Added value: +"Maximum recursion depth for the call graph traversal (default: 3)."
    • addedInput schema / properties / project_root / description
      Added value: +"Root directory of the repository (default: current directory)."
    • addedInput schema / properties / symbol_name / description
      Added value: +"Exact function or method name to trace across the codebase call graph."
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden, and it does so well: read-only AST traversal, deterministic/idempotent, fully offline. It stops short of noting practical limits such as cost/complexity at high max_depth on large codebases, so it is strong but not exhaustive.

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 action and well-organized under Behavior/Usage/Returns headings; every bullet is relevant. The 'Returns' line slightly duplicates the output schema, which is the only small redundancy.

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 read-only trace tool with full schema coverage and an output schema, the description covers purpose, behavior, routing, and result shape. Nothing an agent needs to invoke and interpret it correctly is missing.

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 all three parameters are already documented. The description adds only marginal meaning by framing max_depth as the recursion limit that bounds the rendering and symbol_name as an 'exact' name; the baseline 3 applies when the schema does the heavy lifting.

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+resource: 'Traces deep execution paths across the codebase AST,' then defines both traversal directions (upstream callers, downstream callees). An agent can distinguish it from siblings without opening the schema, and the sibling-routing section reinforces the distinction.

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?

Explicit 'When to use' triggers (debugging execution flows, tracing data paths, seeing recursive calls) and explicit alternatives: 'analyze_change_impact' for blast-radius scoring, 'query_module_dependencies' for module imports. Conditions selecting each sibling are named.

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