cgis_module_graph
Visualize a package's internal module graph: map sub-packages/modules and import, inheritance, and call dependencies with transitive reduction to reveal direct layering and cycles.
Instructions
How one package is built inside: its modules and the dependencies between them.
Nodes are the package's direct children, each sub-package one node (``expand``
lists every module instead). Edges are imports ``-->``, inheritance ``==>``
and calls ``-.->``, each kind transitively reduced so the direct layering
shows; an edge that closes a cycle is never dropped. Dependencies on code
outside the package are summarised per module under the diagram, not drawn.
Test modules and type-only imports are left out. The json form is
``{prefix, nodes, subpackages, edges:[{source,target,kind}], dropped, covered, outside}``;
``covered`` counts the imports not drawn because a drawn ``==>`` joins the
same pair: that arrow then also stands for the import, so read an import
closure over imports and extends together. An import that closes an import
cycle is always drawn.
Run ``cgis_ingest`` first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prefix": "<prefix>"
},
"name": "cgis_module_graph"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expand | No | Every module below the package instead of one node per sub-package. | |
| layers | No | Edge kinds to draw. Calls make the picture much denser. | |
| prefix | Yes | FQN prefix of the package as the graph names it, e.g. cgis.query (cgis_find_symbol shows it), matched on whole dot-segments. A directory above the ingest root, such as src., is dropped. | |
| reduce | No | Drop each edge implied by a longer path, per kind; cycles stay. | |
| db_path | No | SQLite graph built by cgis_ingest. A relative path resolves against the MCP server's working directory, not the agent's — prefer an absolute path. | graph.db |
| exclude_tests | No | Leave test modules out. | |
| output_format | No | mermaid: a diagram plus a table of outside dependencies; json: data. | mermaid |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |