Skip to main content
← MCP Tools

get_callers

Return all graph nodes that have an incoming edge to the given symbol: everywhere it is called or structurally referenced.

Availability: single-repo stdio (travsr mcp), global stdio (travsr mcp --global), and SSE (travsr serve).

Input schema​

{
"type": "object",
"required": ["symbol"],
"properties": {
"symbol": {
"type": "string",
"description": "Symbol name to find callers of (partial match supported)"
},
"path": {
"type": "string",
"description": "Optional path hint to scope an overloaded name to a file or directory: a filename, a relative path, a directory prefix, or a path fragment (e.g. ppr.rs, src/ppr.rs, crates/travsr-retrieval, retrieval)"
},
"repo": {
"type": "string",
"description": "Repo name (run repos_list to discover). Only present in global (multi-repo) sessions and on SSE."
}
},
"additionalProperties": false
}

There is no include_tests, max_results, or column parameter. Ambiguity between two same-named definitions is resolved with path, not with a result limit.

Output format​

Plain text (wrapped in a <travsr-data> envelope), one call site per line, as in the example below: a [call] tag for a real call edge or a [structural] tag for a structural (non-call) reference such as the file that defines the symbol, then the caller's label with its kind prefix (fn:, method:, class:, ...), the kind spelled out in parentheses (function, method, file), an em-dash separator (U+2014), and path:line. On a [call] line the line is the call site; on a structural line (or a call with no recorded site) it is the caller's own definition line, and it is absent when the node has none, as for a file. When a language records multiple call sites under the same edge, each site gets its own line. Past a row cap, the list stops and ends with [showing N of M callers].

An empty answer says which kind of empty it is, as a bracketed [note: ...] line:

  • [note: No symbol named 'x' in the graph. search_symbol matches by word and may find another spelling.] means the name did not resolve. A bare identifier is matched by name prefix, not by substring, so run_init does not resolve to ..._instead_of_run_init. Try search_symbol.
  • [note: 'x' is in the graph but nothing calls or contains it.] means the symbol is known and has no callers.
  • In a multi-repo session, [note: No callers of 'x' found in the searched repo(s): no symbol by that name, or nothing calls it.] when no repo answered.

If symbol matches more than one definition and path cannot disambiguate them, the tool returns a message listing the candidates and asking for a path hint instead of guessing one.

Example​

Run against the Travsr repository itself (trimmed):

Request:

{
"symbol": "wrap_envelope"
}

Response:

[structural] crates/travsr-mcp/src/sanitize.rs (file) — crates/travsr-mcp/src/sanitize.rs
[call] fn:get_subsystem_brief (function) — crates/travsr-mcp/src/tools.rs:4699
[call] fn:find_references_global (function) — crates/travsr-mcp/src/tools.rs:2259
[call] fn:json_response (function) — crates/travsr-mcp/src/observability.rs:287
[call] fn:sanitize_for_mcp (function) — crates/travsr-mcp/src/sanitize.rs:55
[call] fn:get_callers (function) — crates/travsr-mcp/src/tools.rs:676

Response, ambiguous name ("symbol": "knapsack"):

'knapsack' is ambiguous, 2 definitions. Re-run with a `path` hint to pick one of:
filemod:knapsack (file-module) — crates/travsr-retrieval/src/lib.rs:13
fn:knapsack (function) — crates/travsr-retrieval/src/knapsack.rs:60

When to use​

  • Before changing a method signature: find all callers so you know what to update.
  • Dead code detection: an empty result for a known symbol may mean it is unused, or that semantic analysis has not run yet for its language; check get_lang_status before concluding "unused".
  • Impact analysis: see which subsystems call a piece of security-critical code.