The analyze_structure tool helps you understand how different parts of your codebase relate to each other. It analyzes imports and exports to map dependencies, finds connection paths between files, and measures coupling strength between modules.
Stellarion builds a dependency graph of your project by analyzing import and export statements. This graph is stored in KuzuDB and can be queried for relationships, paths, and coupling metrics.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | No | dependencies | Analysis type: dependencies, paths, or coupling |
path | string | No | - | File to analyze (required for dependencies) |
from | string | No | - | Starting file (required for paths) |
to | string | No | - | Target file (required for paths) |
depth | number | No | 2 | Maximum traversal depth for dependency chains |
direction | string | No | both | forward (imports), backward (dependents), or both |
maxPaths | number | No | 5 | Maximum number of paths to return |
threshold | number | No | 0 | Minimum coupling strength to include |
mcp__stellarion__analyze_structure type:dependencies path:src/index.ts depth:3 direction:both
See what a file imports and what files depend on it.
Natural Language:
What files does src/services/userService.ts depend on? What depends on it?
Direct MCP Call:
mcp__stellarion__analyze_structure type:dependencies path:src/services/userService.ts depth:2
Returns:
depth)Find all dependency paths connecting two files.
Natural Language:
How is src/api/routes.ts connected to src/db/connection.ts?
Direct MCP Call:
mcp__stellarion__analyze_structure type:paths from:src/api/routes.ts to:src/db/connection.ts maxPaths:10
Returns: All dependency chains connecting the two files, ordered by path length
Measure coupling strength between modules based on shared dependencies.
Natural Language:
Which modules in my project are most tightly coupled?
Direct MCP Call:
mcp__stellarion__analyze_structure type:coupling threshold:5
Returns: Module pairs ranked by coupling strength
Natural Language:
Analyze the dependencies of src/index.ts. What does it import? What imports it?
Direct MCP Call:
mcp__stellarion__analyze_structure type:dependencies path:src/index.ts depth:3 direction:both
Natural Language:
What files does the auth module import?
Direct MCP Call:
mcp__stellarion__analyze_structure type:dependencies path:src/auth/index.ts direction:forward depth:2
Natural Language:
What files would be affected if I change src/utils/helpers.ts?
Direct MCP Call:
mcp__stellarion__analyze_structure type:dependencies path:src/utils/helpers.ts direction:backward depth:3
Natural Language:
How does src/components/UserProfile.tsx eventually connect to src/db/models.ts?
Direct MCP Call:
mcp__stellarion__analyze_structure type:paths from:src/components/UserProfile.tsx to:src/db/models.ts
Natural Language:
Which parts of my codebase are too tightly coupled?
Direct MCP Call:
mcp__stellarion__analyze_structure type:coupling threshold:10
| Field | Description |
|---|---|
| Direct dependencies | Files imported by the target file |
| Direct dependents | Files that import the target file |
| Transitive dependencies | Indirect dependencies up to depth |
| Dependency count | Total number of dependencies |
| Dependent count | Total number of dependents |
| Field | Description |
|---|---|
| Path | Sequence of files from source to target |
| Path length | Number of hops in the chain |
| Total paths found | Number of paths discovered |
| Field | Description |
|---|---|
| Module pair | The two modules being compared |
| Coupling strength | Score based on shared dependencies |
| Shared dependencies | Common files both modules depend on |
| Direction | Description | Use Case |
|---|---|---|
forward | Only imports (what this file uses) | Understanding dependencies |
backward | Only dependents (what uses this file) | Impact analysis |
both | Both directions | Complete picture |
| Score | Interpretation | Action |
|---|---|---|
| 0-5 | Low coupling | Healthy modularity |
| 5-15 | Moderate coupling | Monitor during refactoring |
| 15-30 | High coupling | Consider architectural review |
| 30+ | Very high coupling | Strong candidate for refactoring |
analyze_structure to understand connections, then analyze_impact for risk scoresanalyze_quality to check their complexityfind_refactoring for improvement suggestions