Stellarion
Tools

stellarion_get_call_graph

Map function call chains showing callers and callees

Visualizes function call relationships as a graph, showing who calls a function and what it calls. Traverses multiple levels deep to reveal the full call chain.

When to Use

  • Tracing execution flow through the codebase
  • Understanding how a function fits into the system
  • Finding dead code (functions with no callers)
  • Debugging by tracing the path from entry point to failure
  • Assessing the scope of a function's usage

For simpler use cases, consider stellarion_get_callers (reverse only) or stellarion_get_callees (forward only) which return flat lists instead of a full graph.

Parameters

ParameterTypeRequiredDefaultDescription
uristringYes--File URI containing the function (e.g., file:///path/to/file.ts)
linenumberYes--Line number of the function (0-indexed)
depthnumberNo3How many levels deep to traverse (1-10)
directionenumNobothcallers (who calls this), callees (what this calls), or both
summarybooleanNofalseReturn a condensed summary for large call graphs

Examples

Full Call Graph

Natural Language: "Show me the complete call graph for handleRequest"

MCP Tool Call:

{
  "name": "stellarion_get_call_graph",
  "arguments": {
    "uri": "file:///home/dev/project/src/server/handler.ts",
    "line": 42,
    "depth": 3,
    "direction": "both"
  }
}

Returns: A graph with handleRequest at the center, showing 3 levels of callers (route dispatcher, HTTP server, test harness) and 3 levels of callees (validation, business logic, database queries).

Trace Callers Only

Natural Language: "Who calls calculateTax and where does the call originate?"

MCP Tool Call:

{
  "name": "stellarion_get_call_graph",
  "arguments": {
    "uri": "file:///home/dev/project/src/billing/tax.rs",
    "line": 18,
    "depth": 5,
    "direction": "callers"
  }
}

Returns: The caller chain from calculateTax up through processInvoice, createOrder, handleCheckout, to the HTTP route handler.

Shallow Dependency Check

Natural Language: "What does this function directly call?"

MCP Tool Call:

{
  "name": "stellarion_get_call_graph",
  "arguments": {
    "uri": "file:///home/dev/project/src/auth/login.py",
    "line": 10,
    "depth": 1,
    "direction": "callees"
  }
}

Returns: Only the direct callees of the login function: validate_credentials, generate_token, log_login_attempt.

Output Format

The response is a graph structure containing:

  • nodes -- Each node represents a function with: name, kind (function/method/constructor), file path, line range, and optional signature.
  • edges -- Each edge represents a call relationship with source and target node references.
  • root -- The node ID of the target function you queried.
  • depth -- Actual depth reached (may be less than requested if the graph terminates).

Tips

  • Start with depth: 1 to see immediate relationships, then increase depth if you need to trace further.
  • Use direction: "callers" with high depth to find entry points that lead to a function. This is useful for debugging ("how does a request reach this code?").
  • Use direction: "callees" to understand what a function touches. This helps assess the complexity and side effects of a function.
  • For large codebases, set summary: true to avoid overwhelming output. The summary shows counts and key paths instead of every node.
  • Chain with stellarion_analyze_impact for a higher-level risk assessment that includes cross-project and transitive impacts beyond what the call graph shows.