Analyzes file-level import and dependency relationships. Shows what a file imports, what imports it, or both -- traversing multiple levels to reveal the full module dependency structure.
This tool operates at the file/module level. For function-level call relationships, use stellarion_get_call_graph instead.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| uri | string | Yes | -- | File URI to analyze (e.g., file:///path/to/file.ts) |
| depth | number | No | 3 | How many levels of dependencies to traverse (1-10) |
| includeExternal | boolean | No | false | Whether to include external dependencies from node_modules or packages |
| direction | enum | No | both | imports (what this file uses), importedBy (what uses this file), or both |
| summary | boolean | No | false | Return a condensed summary for large graphs |
Natural Language: "Show me all the dependencies of the auth module"
MCP Tool Call:
{
"name": "stellarion_get_dependency_graph",
"arguments": {
"uri": "file:///home/dev/project/src/auth/index.ts",
"depth": 3,
"direction": "both"
}
}
Returns: A graph showing the auth module's imports (crypto, database, config) and everything that imports it (routes, middleware, tests), traversed 3 levels deep.
Natural Language: "What files depend on the database connection module?"
MCP Tool Call:
{
"name": "stellarion_get_dependency_graph",
"arguments": {
"uri": "file:///home/dev/project/src/db/connection.py",
"depth": 2,
"direction": "importedBy"
}
}
Returns: All files that import the database connection module, plus files that import those files, showing the full consumer chain.
Natural Language: "What external libraries does this file use?"
MCP Tool Call:
{
"name": "stellarion_get_dependency_graph",
"arguments": {
"uri": "file:///home/dev/project/src/api/client.ts",
"depth": 1,
"includeExternal": true,
"direction": "imports"
}
}
Returns: Both internal imports (utils, config) and external packages (axios, lodash, zod) used by this file.
The response is a graph structure containing:
direction: "importedBy" before modifying a module to see everything that depends on it. This is the module-level equivalent of impact analysis.depth: 1 for a quick view of direct relationships. Increase depth to trace longer import chains.includeExternal: false (default) when you only care about your own code's structure. Set it to true when auditing third-party dependency usage.cycles field. Use stellarion_analyze_coupling (Pro) for deeper coupling metrics including instability scores.stellarion_get_call_graph instead. Dependency graphs show file-level imports, not runtime call relationships.