gograph_coupling
Report fan-in (Ca), fan-out (Ce), and instability (I) per package to identify tightly coupled packages and evaluate architectural layering in Go projects.
Instructions
Report fan-in (Ca), fan-out (Ce), and instability ratio (I = Ce/(Ca+Ce)) per package. Instability range [0,1]: 0 = maximally stable, 1 = maximally unstable. The MCP server checks freshness before this call and refreshes in the current requested analysis mode; precise and precise_fallback graphs retry CHA/SSA after source changes. Read-only; no side effects. package filters by name substring; include_stdlib adds stdlib (default false); internal_only restricts to this module's packages only. WHEN TO USE: When evaluating package isolation, planning architectural layering, or identifying packages that are too tightly coupled. NOT TO USE: For single-function complexity (use gograph_complexity or gograph_hotspot); for reverse package dependency lookup (use gograph_dependents). RETURNS: Array of package coupling records with Ca, Ce, and instability score; empty when no packages match the filter.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package | No | Optional package name substring to filter results | |
| internal_only | No | Restrict the report to the project's own packages (anything starting with the module path from go.mod). Strictly stronger than excluding stdlib — also excludes third-party deps. | |
| include_stdlib | No | Include standard-library packages in the report. Default false — users asking 'how coupled is my code?' rarely care about stdlib coupling. |