get_dependency_path
Shortest dependency path between two files or modules, plus visual context (common ancestors, shared neighbors, bridge suggestions) when no direct path exists. Opt-in, off by default.
Answers "how are these two parts of the codebase connected?" by walking the import graph. When a direct path exists, returns it with the edge relationship at each hop. When it doesn't, returns diagnostic context instead of a bare miss: nearest common ancestors, shared neighbors, community membership, and bridge-node suggestions, so the agent can debug an architectural silo instead of giving up.
Off by default
Registered but not part of the default tool surface in any mode. Turn it on per repo:
# .repowise/config.yaml
mcp:
tools: ["+get_dependency_path"]or per launch with repowise mcp --tools "+get_dependency_path". See
Configuring the tool surface for the
full +/- delta syntax.
When to call
- Understanding coupling between two files or modules that don't obviously call each other.
- Debugging why an expected dependency doesn't show up in
get_contextorget_risk. - Architectural silos: when two areas of the codebase should be connected but aren't, the visual context on a miss suggests where a bridge belongs.
Parameters
| Parameter | Type | Description |
|---|---|---|
sourcerequired | string | Source file or module path. |
targetrequired | string | Target file or module path. |
repo | string | Repository alias. "all" is not supported. |
Returns
When a path exists:
| Field | Meaning |
|---|---|
path | Ordered list of {node, relationship} hops from source to target |
distance | Hop count |
explanation | One-line summary |
When no direct path exists, path is empty and distance is -1.
visual_context carries the diagnostic instead:
| Field | Meaning |
|---|---|
reverse_path | An object, not a boolean. {"exists": false} when no reverse path exists; when one does, {"exists": true, "path": [...], "distance": N, "note": "..."} |
nearest_common_ancestors | Up to 5 nodes both source and target reach, ranked by combined distance |
shared_neighbors | Direct neighbors in common |
community | Whether source and target sit in the same architectural community |
bridge_suggestions | High-PageRank nodes that touch both communities, when source and target are in different ones |
disconnected | true if source and target are in completely separate weakly-connected components |
source_component_size, target_component_size | (only when disconnected: true) size of each node's weakly-connected component |
suggestion | A one-line, best-effort read of the above (shared dependency, shared neighbor, reverse-only, or genuinely disconnected) |
co_change_signal | (when present) source and target aren't import-connected but co-change frequently, suggesting logical coupling instead |
Example
get_dependency_path(source="src/api/routes.py", target="src/db/models.py")Things worth knowing
- Excluded paths error out. Passing a
sourceortargetmatched byexclude_patternsreturns an error rather than a path through code the index doesn't track. - The graph used is the filtered graph. Excluded nodes and edges never appear in a returned path, a common ancestor, or a bridge suggestion.
- Co-change is a fallback signal, not a substitute.
co_change_signalonly appears on a genuine no-path miss, and only when target is literally one of source's recorded co-change partners.
For "what breaks if I change this" instead of "how are these two
connected", reach for get_risk or, across repos
in workspace mode, get_blast_radius.
generate_refactoring_code
Turns one structured refactoring plan from get_health(include=["refactoring"]) into generated code and a unified diff, grounded on the plan plus the real source it references.
get_execution_flows
Top entry points and their call traces, showing how the codebase actually executes end to end. Opt-in, off by default.