Skip to main content
Glama

Build a Call Graph

call_graph
Read-onlyIdempotent

Builds a depth-limited call graph rooted at a method, traversing callees or callers to reveal call relationships and safely handle cycles.

Instructions

Build a depth-limited call graph rooted at a method NAME: direction='callees' follows project-internal calls outward, 'callers' the inverse (who calls this). Returns root, direction, maxDepth and (caller, callee) edges using method-lookup keys, cycle-safe and capped at 500 edges (truncated flag). A creation (new X(...)) is an edge to the constructor it binds, keyed 'Ns.X.X(params)', and both directions walk on through constructors: into what one calls and creates, out to the code creating the object. A local function's key ends in '@::', character offsets, not a line ('localFunctionKeyNote' repeats this when the answer holds one). A bare name roots EVERY same-named declaration and the graph is their union (a common name like 'ExecuteAsync' pulls in unrelated members); 'Type.Method' roots only that type's declarations of the name, overloads included. With direction='callers' every node also brings in the callers of the interface and abstract members it implements, at every hop as impact_of_change does (a call through a contract is recorded on it); 'viaContract' names those members with their implementation counts (one: exact, several: a union) and the nodes that brought them in ('creditedBy'). 'generatedStops' counts the generated documents (' (generated)') among the callers; the walk stops at them. 'generatedInvokers' names the walked methods generated code invokes without being their recorded caller (a [RelayCommand] method). 'rootedAt' lists the declarations actually walked: check it when the result looks too big (re-query a rarer or qualified name) and when it is empty (the name resolved to nothing, which an empty edge list does not tell). Optional: 'note' (on a callers walk, callers in unread VB or F# code are missing; for an empty rootedAt, unread VB, F# or markup code may declare the name) and 'nearest' (a close declared method name for an empty rootedAt).

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": {
      "sessionId": "<sessionId>",
      "method": "<method>"
    },
    "name": "call_graph"
  }
}

Input Schema

NameRequiredDescriptionDefault
depthNoMax traversal depth (1-10). Default 2.
methodYesThe root method's name, bare or as 'Type.Method'.
directionNo'callees' (default) or 'callers'.callees
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46517
    • changedInput schema / properties / method / description
      Previous value: -"The root method's name."New value: +"The root method's name, bare or as 'Type.Method'."
  2. Changed1 schema field changedv0.5.46513
    • changedInput schema / properties / sessionId / description
      Previous value: -"The session_id returned by analyze_solution."New value: +"The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use."
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Well beyond the readOnly/idempotent annotations, it discloses cycle-safety, a hard 500-edge cap with a 'truncated' flag, constructor-edge semantics with key format, local-function key offsets, contract/interface expansion with 'viaContract' and 'creditedBy', and generation-related stopping behavior. These are exactly the behavioral traits that would otherwise cause misread results.

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?

Purpose is front-loaded in the first sentence and nearly every clause carries load-bearing information about edge keys, truncation, or empty-result diagnosis. The cost is density: one unbroken paragraph of quoted field names that an agent must parse linearly, with no visual separation between return-value fields and rooting caveats.

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?

There is no output schema, so the description carries the full return-shape burden and does so — enumerating root, direction, maxDepth, edges, truncated, viaContract, generatedStops, generatedInvokers, rootedAt, note, and nearest. For a tool this complex with four parameters, nothing an agent needs to interpret results correctly appears to be missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning beyond it: it explains the consequence of each direction value, that a bare name roots every same-named declaration and unions them ('ExecuteAsync' pulls in unrelated members), and that 'Type.Method' scopes to one type's overloads. Only 'depth' and 'sessionId' are left entirely to 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?

The opening clause names a specific verb and resource — 'Build a depth-limited call graph rooted at a method' — and immediately disambiguates the two traversal modes ('callees' outward vs 'callers' inverse). An agent can distinguish this from siblings like find_usages or impact_of_change without opening the schema.

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

Usage Guidelines4/5

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

It gives concrete operational guidance: check 'rootedAt' when the result looks too big and re-query a rarer or qualified name, and check it when empty because an empty edge list does not reveal non-resolution. It also explains bare-name vs 'Type.Method' rooting. It stops short of explicit when-to-use-this-instead-of-X routing, referencing impact_of_change only as a behavioral analogue rather than as an alternative to choose between.

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