Stellarion
Tools

stellarion_traverse_graph

Custom graph traversal with edge type, node type, direction, and depth filters

The low-level graph exploration tool. Lets you walk the code graph from any node, filtering by edge types (calls, imports, contains, etc.), node types (function, class, module, etc.), and traversal direction. Use this when the higher-level tools don't cover your specific query.

When to Use

  • You need a traversal pattern not covered by get_callers or get_callees (e.g., following import edges)
  • You want to explore the graph structure around a specific node
  • You need to combine multiple edge types in one traversal
  • You are building a custom analysis by walking the graph manually

Parameters

ParameterTypeRequiredDefaultDescription
nodeIdstringyesID of the starting node (from a previous search or tool result)
directionenumnooutgoingTraversal direction: outgoing, incoming, both
edgeTypesarraynoFilter to specific edge types (e.g., ["calls", "imports", "contains"])
nodeTypesarraynoFilter to specific node types (e.g., ["function", "class", "module"])
maxDepthnumberno3Maximum traversal depth
limitnumbernoMaximum number of nodes to return

Examples

Find all modules imported by a file

Natural language:

What modules does this file import?

MCP call:

{
  "tool": "stellarion_traverse_graph",
  "arguments": {
    "nodeId": "file:src/main.ts",
    "direction": "outgoing",
    "edgeTypes": ["imports"]
  }
}

Find everything contained in a module

Natural language:

Show me all functions and classes defined in the auth module

MCP call:

{
  "tool": "stellarion_traverse_graph",
  "arguments": {
    "nodeId": "module:src/auth",
    "direction": "outgoing",
    "edgeTypes": ["contains"],
    "nodeTypes": ["function", "class"]
  }
}

Explore all relationships around a class

Natural language:

Show me everything connected to the UserService class — imports, methods, callers, callees

MCP call:

{
  "tool": "stellarion_traverse_graph",
  "arguments": {
    "nodeId": "class:UserService",
    "direction": "both",
    "maxDepth": 2
  }
}

Find files that depend on a module

Natural language:

What files import the database module?

MCP call:

{
  "tool": "stellarion_traverse_graph",
  "arguments": {
    "nodeId": "module:src/db",
    "direction": "incoming",
    "edgeTypes": ["imports"],
    "maxDepth": 1
  }
}

Output Format

Returns a subgraph of nodes and edges:

  • nodes — List of discovered nodes, each with id, type, name, uri, line
  • edges — List of edges connecting them, each with source, target, type

Tips

  • Node IDs come from other tool results. Use stellarion_symbol_search to find a starting node, then use its ID here.
  • Common edge types: calls, imports, contains, implements, extends, uses.
  • Common node types: function, class, method, module, interface, variable, type.
  • Keep maxDepth low (1-2) when exploring broadly with no edge type filter — large graphs can return a lot of data.
  • Use this tool for unusual traversals. For common patterns, prefer the dedicated tools: stellarion_get_callers, stellarion_get_callees, stellarion_find_by_imports.