cgis_analyze_impact
Find everything that reaches a Python or TypeScript symbol to see what breaks if you change it. Returns callers, importers, subclasses, and type references from a local code graph.
Instructions
Upstream subgraph of one FQN: everything that reaches it within depth hops.
Follows every edge except containment — in practice callers, importers,
subclasses, type references and DI dependents — within internal code, so this
answers "what breaks if I change X?". The
enclosing class or file and stdlib/third-party nodes are left out unless
``include_structure`` / ``include_external`` ask for them — the same view as
the CLI's ``impact``. Test callers are left out unless ``include_tests``
asks for them, and counted in ``excluded_tests``. A file that imports a
symbol is listed, but the walk does not continue to the files importing
that file; a file's own impact still does. At most ``max_nodes`` nodes come
back, nearest first, and a cut is reported in ``truncated``. For what X
depends on use
``cgis_trace_flow``; for only the members of a module or class,
``cgis_get_structure``; for a source-included brief to read before editing
one symbol, ``cgis_context``.
``output_format="text"`` returns an indented tree of callers, one line
per node — the compact form to read; ``"mermaid"`` (default)
returns a diagram; ``"json"`` returns a joinable ``{root, nodes, edges,
coverage}`` payload with real FQNs — letting an agent compute set
differences (e.g. "which route handlers never reach ``verify_ownership``?")
directly. ``coverage`` counts unresolved calls whose name matches a
traversed function, method or class: callers that may be missing, named in
``top_unresolved``. It is an upper bound — a common name matches calls on
unrelated objects, which the names make visible.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fqn | Yes | Fully qualified name, e.g. pkg.module.Class.method. A unique dot-boundary suffix also resolves; an ambiguous one returns candidates. Use cgis_find_symbol to look a name up. | |
| depth | No | Maximum edge hops upstream, over callers, importers, subclasses, type references and DI dependents (plus the enclosing class or file with include_structure). A hop from an override to the base or interface method it implements costs no depth, so a caller through the interface is at depth 1. | |
| 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 |
| max_nodes | No | Most nodes to return, nearest levels first. A level that does not fit is cut and the walk stops there; the answer says where and how many were left out, so a smaller depth or a narrower FQN can follow. | |
| include_tests | No | Also return test code. Off by default: on a large repo tests outnumber the production code an answer is about. The answer says how many were left out — a floor when it is also truncated, since levels past the cut are not walked. A root that is itself a test keeps them. | |
| output_format | No | "text" for an indented tree, one line per node — the cheapest to read; "mermaid" for a diagram; or "json" for a payload with real FQNs, to compute with (case-insensitive). Any other value returns an error. | mermaid |
| include_external | No | Also return stdlib, third-party and unresolved call targets — calls on values whose type is decided at runtime. Off by default, as in the CLI, because they dominate the payload; in json, coverage/top_unresolved still counts what was dropped. | |
| include_structure | No | Also follow containment (CONTAINS/DECLARES): a module's or class's own members, and the class or file enclosing a symbol. Off by default, as in the CLI; cgis_get_structure is the tool for members alone. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |