Skip to main content
Glama

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

NameRequiredDescriptionDefault
fqnYesFully 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.
depthNoMaximum 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_pathNoSQLite 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_nodesNoMost 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_testsNoAlso 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_formatNo"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_externalNoAlso 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_structureNoAlso 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

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.21.14
    • changedInput schema / properties / depth / description
      Previous value: -"Maximum edge hops upstream, over callers, importers, subclasses, type references and DI dependents (plus the enclosing class or file with include_structure)."New value: +"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."
  2. Changed3 schema fields changedv0.21.12
    • addedInput schema / properties / include_tests
      Added value: +{
      +  "default": false,
      +  "description": "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.",
      +  "title": "Include Tests",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / max_nodes
      Added value: +{
      +  "default": 100,
      +  "description": "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.",
      +  "minimum": 1,
      +  "title": "Max Nodes",
      +  "type": "integer"
      +}
    • changedInput schema / properties / output_format / description
      Previous value: -"\"mermaid\" for a diagram, or \"json\" for a payload with real FQNs (case-insensitive). Any other value returns an error."New value: +"\"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."
  3. Changed3 schema fields changedv0.21.6
    • changedInput schema / properties / depth / description
      Previous value: -"Maximum edge hops upstream. Every edge type counts as a hop — callers, importers, subclasses, type references, DI dependents and the enclosing class or file all appear alongside each other."New value: +"Maximum edge hops upstream, over callers, importers, subclasses, type references and DI dependents (plus the enclosing class or file with include_structure)."
    • addedInput schema / properties / include_external
      Added value: +{
      +  "default": false,
      +  "description": "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.",
      +  "title": "Include External",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / include_structure
      Added value: +{
      +  "default": false,
      +  "description": "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.",
      +  "title": "Include Structure",
      +  "type": "boolean"
      +}
  4. Changed1 schema field changedv0.21.5
    • changedInput schema / properties / depth / description
      Previous value: -"Maximum edge hops upstream. Every edge type counts as a hop — CALLS, but also IMPORTS, CONTAINS and REFERENCES — so modules importing the target and the file containing it appear alongside its callers."New value: +"Maximum edge hops upstream. Every edge type counts as a hop — callers, importers, subclasses, type references, DI dependents and the enclosing class or file all appear alongside each other."
  5. Changed4 schema fields changedv0.21.1
    • addedInput schema / properties / db_path / description
      Added value: +"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."
    • addedInput schema / properties / depth / description
      Added value: +"Maximum edge hops upstream. Every edge type counts as a hop — CALLS, but also IMPORTS, CONTAINS and REFERENCES — so modules importing the target and the file containing it appear alongside its callers."
    • addedInput schema / properties / fqn / description
      Added value: +"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."
    • addedInput schema / properties / output_format / description
      Added value: +"\"mermaid\" for a diagram, or \"json\" for a payload with real FQNs (case-insensitive). Any other value returns an error."
  6. First observedv0.21.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden and does: it discloses traversal exclusions (containment, stdlib/third-party, tests), the file-import boundary rule, max_nodes truncation with 'nearest first' and the truncated flag, the excluded_tests count, and the coverage/top_unresolved upper-bound caveat with the reason (common-name collisions). That is unusually complete behavioral detail for a graph walker.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Information-dense and roughly front-loaded (core definition first, siblings near the end, output formats last), but the prose is long and relies on stacked clauses and parentheticals; some parenthetical caveats could be trimmed without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter graph-analysis tool with no annotations, the description covers traversal semantics, exclusions, truncation behavior, output shapes, and the meaning of coverage/top_unresolved; an output_schema exists, so return-format explanation is a bonus rather than a requirement. Nothing an agent needs to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description still adds value by explaining what each flag actually changes in the result set (include_structure follows CONTAINS/DECLARES, include_external adds runtime-resolved targets, include_tests is counted in excluded_tests, output_format=json yields a joinable {root,nodes,edges,coverage} payload enabling set-difference queries).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence states a precise verb+resource+scope ('Upstream subgraph of one FQN ... within depth hops') and the second names the exact edge types traversed, so the agent knows this computes reverse dependencies ('what breaks if I change X?'). It also distinguishes itself from cgis_trace_flow (dependencies), cgis_get_structure (members) and cgis_context (editing brief).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing: '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.' Defaults (tests, external, structure excluded) are stated with the reasons and the same view as the CLI's `impact`, so when-to-use and when-not-to-use are both covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.