Skip to main content
← MCP Tools

get_execution_path

Find the lowest-cost path from a source symbol to a sink symbol through the code graph, using Dijkstra's shortest path plus a λ-corridor of nearby nodes. (This is not a Prize-Collecting Steiner Tree; real PCST is scoped for later and gated on a benchmark showing it beats this approach.) Returns the path itself first, then, under a separate heading, the nodes that are near that path but not on it, so the two are never confused.

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

Input schema​

{
"type": "object",
"required": ["source", "sink"],
"properties": {
"source": {
"type": "string",
"description": "Source symbol name (partial match supported)"
},
"sink": {
"type": "string",
"description": "Sink symbol name (partial match supported)"
},
"repo": {
"type": "string",
"description": "Repo name (run repos_list to discover). Only present in global (multi-repo) sessions and on SSE. Always supply to avoid cross-repo noise; omit only when explicitly querying across all repos."
}
},
"additionalProperties": false
}

There is no token_budget parameter and no line/edge field per node. The tool takes only source, sink, and (in global sessions and over SSE) repo.

Output format​

Plain text (wrapped in a <travsr-data> envelope), not JSON. The route and the corridor are rendered as two separate lists. The route comes first, under a path (N steps, source to sink): header where N counts hops (edges), so a route of N+1 nodes reads N steps. Each line is the node's label with its kind prefix (fn:, method:), the kind spelled out in parentheses, an em-dash separator (U+2014), and the file path, in order from source to sink. Nodes inside the λ-corridor around the route that are not part of the call chain itself are listed after a blank line under a second nearby context (N nodes, within the corridor around that path, NOT on it): heading. When either symbol does not resolve, or resolves but no connecting call chain exists, the tool returns a one-line message saying so instead of an empty result.

Each endpoint goes through the same tiered resolver that graph and search_symbol use. If a bare name has several definitions, the tool does not take the first match: it says which side is ambiguous (source 'run' is ambiguous, 4 definitions.) and lists the candidates, so you are never told "no path" about the wrong pair. Where the candidates differ by signature, each one is listed as a signature you can pass back as the endpoint (for example method:Runner.run). Where several share the same signature and differ only by file, that does not disambiguate, and the message points you to a tool that takes a path hint (get_callers, find_references) instead.

Two more cases affect the response:

  • If Phase B (the semantic call-edge index) has never finished for this repo, the tool skips the search entirely and returns JSON instead of the text format above: {"status":"pending","message":"Calls are still being traced for this commit. Run `travsr init` to finish now, then ask again."}, wrapped in the same <travsr-data> envelope as every other answer.
  • If Phase B has finished at least once but is stale (behind the current commit, or a background reindex dropped call edges without moving HEAD), a bracketed note such as [note: call-graph index incomplete; semantic analysis has not caught up with the current commit; call edges may be missing and empty results are not authoritative. Run \travsr status` to check progress.]` is appended after the path (or no-path) text, on its own line.

Example​

Run against the Travsr repository itself (corridor trimmed):

Request:

{
"source": "get_context",
"sink": "wrap_envelope"
}

Response:

path (2 steps, source to sink):
fn:get_context (function) — crates/travsr-mcp/src/tools.rs
fn:get_context_with_filter (function) — crates/travsr-mcp/src/tools.rs
fn:wrap_envelope (function) — crates/travsr-mcp/src/sanitize.rs

nearby context (52 nodes, within the corridor around that path, NOT on it):
fn:get_context_body (function) — crates/travsr-mcp/src/tools.rs
fn:build_context_signals_with_r2 (function) — crates/travsr-mcp/src/tools.rs
fn:match_source (function) — crates/travsr-mcp/src/seed.rs
...

If no path exists:

no path found: 'login' and 'sign' both resolved, but no connecting call chain was found within traversal limits.

If a name does not resolve at all:

could not resolve source 'logn', verify the names with search_symbol, or pass full signatures (e.g. fn:charge).

When to use​

  • Security audit: trace the path from a public HTTP handler to a database write or crypto primitive.
  • Debugging: find why a change in module A unexpectedly affects module B by tracing the execution path.
  • Documentation: generate accurate call graphs for design docs.

Notes​

  • "No path", "symbol not found" and "ambiguous endpoint" are each returned as an explicit sentence, never as a silent empty response, so an agent never mistakes "cannot see it yet" for "definitely not connected".
  • The nodes listed under "nearby context" come from the λ-corridor around the Dijkstra route; they are not on the route and are never presented as call-chain steps.