Skip to main content
Glama

trace_calls

Read-onlyIdempotent

Trace callers and callees around a function, or find a call path between two functions, to answer questions about how code calls are connected.

Instructions

Traces the call graph around one function, hop by hop: function is a function or method name, direction in lists who calls it, out lists what it calls; with to it returns a call path from the function to that other one. Use it for questions about calls only: for every kind of use of a name (imports, types, references and calls) use find_usages. When the graph holds no call edge for the function, the answer gives the links between the modules instead and says so. depth is 2 hops by default, 5 for a path. Returns one line per caller, callee or step. A long list stops at 200 items unless all is true. A name the graph does not hold is answered with an error line, with suggestions when similar names exist.

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": {
      "function": "<function>"
    },
    "name": "trace_calls"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNoAnother function: the answer is a call path from `function` to it.
allNoList everything instead of stopping at 200 items.
depthNoHow many hops to follow (default 2; 5 for a path with `to`).
functionYesFunction or method name; literal text with optional .* wildcards.
directionNoin: who calls the function; out: what the function calls. Not used with `to`.in

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.15.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations (which already declare read-only, idempotent, non-destructive, closed-world), the description discloses the fallback when no call edge exists (module-level links, and that it says so), the 200-item truncation unless `all` is true, the one-line-per-item return shape, and that unknown names produce an error line with suggestions. These are exactly the behaviors an agent cannot infer from the annotations.

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, then mode, then routing rule, then edge cases — a sensible order with no filler sentences. It is dense and clause-heavy in places, but nearly every clause carries operational information, so nothing substantial is wasted.

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?

With no output schema, the description takes on the return-value burden and does so: one line per caller/callee/step, truncation at 200, and error lines with name suggestions. Combined with the two traversal modes and the no-call-edge fallback, an agent has everything needed to call and interpret this tool.

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 baseline is 3; the description adds value by tying `direction` and `to` to the shape of the answer, restating the differing default depth for a path (5 vs 2), and supplying the concrete 200-item cap that the `all` schema text only alludes to. It does not explain the `.*` wildcard behavior of `function` beyond what the schema already states, so it sits just above baseline rather than at the top.

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 ('Traces the call graph around one function, hop by hop') and immediately bounds the scope to calls only, naming find_usages as the tool for other kinds of name usage. An agent can distinguish it from the sibling without opening either 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?

Explicit routing rule: 'Use it for questions about calls only' and 'for every kind of use of a name (imports, types, references and calls) use `find_usages`.' It also describes the two modes (hop-by-hop traversal vs. path with `to`), so the agent knows which invocation shape fits which question.

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