Skip to main content
Glama

cgis_trace_flow

Trace all downstream dependencies of a code symbol across calls, imports, inheritance, and references. Get a Mermaid diagram or JSON subgraph showing what the selected function or module depends on.

Instructions

Downstream subgraph of one FQN: everything it reaches within depth hops.

Follows every edge except containment — in practice calls, imports,
inheritance, DI dependencies and references — between internal code, so this
answers "what does X depend on?". Containment and
stdlib/third-party nodes are left out unless ``include_structure`` /
``include_external`` ask for them (external covers stdlib, third-party and
unresolved call targets) — the same view as the CLI's ``trace``.
For what depends on X use
``cgis_analyze_impact``; 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="mermaid"`` (default) returns a human-readable diagram;
``"json"`` returns a joinable ``{root, nodes, edges, coverage}`` payload
with real FQNs (not display hashes) for agent/CI use. ``coverage`` counts
the calls the traversed functions make that resolved to nothing, and
``top_unresolved`` names the most frequent. Read the names, not only the
ratio: in Python most are methods on untyped locals (``logger.info``,
``items.append``), which cut nothing short. Use ``cgis_ingest`` first if
the database does not exist yet.

Input Schema

TableJSON 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 downstream, over calls, imports, inheritance, DI dependencies and references (plus containment with include_structure).
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
output_formatNo"mermaid" for a diagram, or "json" for a payload with real FQNs (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

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.21.6
    • changedInput schema / properties / depth / description
      Previous value: -"Maximum edge hops downstream. Every edge type counts as a hop — calls, imports, inheritance, DI dependencies, references and containment — so from a module or class the first hop is mostly its own members and imports."New value: +"Maximum edge hops downstream, over calls, imports, inheritance, DI dependencies and references (plus containment 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"
      +}
  2. Changed1 schema field changedv0.21.5
    • changedInput schema / properties / depth / description
      Previous value: -"Maximum edge hops downstream. Every edge type counts as a hop — CALLS, but also IMPORTS, CONTAINS and REFERENCES — so from a module the first hops are mostly imports and structure."New value: +"Maximum edge hops downstream. Every edge type counts as a hop — calls, imports, inheritance, DI dependencies, references and containment — so from a module or class the first hop is mostly its own members and imports."
  3. 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 downstream. Every edge type counts as a hop — CALLS, but also IMPORTS, CONTAINS and REFERENCES — so from a module the first hops are mostly imports and structure."
    • 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."
  4. First observedv0.21.0

TDQS

A4.6/5.0
Behavior4/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 of behavioral disclosure. It discloses that containment edges are excluded by default, that stdlib/third-party/unresolved nodes are excluded unless flags ask for them, that output_format='mermaid' is the default and 'json' returns a joinable payload with real FQNs, and that coverage counts calls that resolved to nothing. It also warns about interpreting top_unresolved ('Read the names, not only the ratio'). The only minor gap is that it doesn't explicitly state the operation is read-only, but the description's framing as a traversal/query makes that reasonably clear.

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?

The description is dense but well-organized: the core definition is front-loaded in the first sentence, followed by edge-type details, then sibling routing, then output format details. Every sentence earns its place. It is longer than the HIGH calibration example, but the tool is more complex (6 params, multiple output formats, sibling relationships), so the length is justified. It loses one point for being somewhat dense in the middle section where edge types and exclusions are packed together.

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?

Given the tool's complexity (6 parameters, two output formats, multiple sibling relationships, and a database prerequisite), the description covers everything an agent needs: what the tool does, when to use it, what the output formats return, how to interpret the coverage field, and the prerequisite (cgis_ingest). The output schema exists, so return values need not be spelled out. The description is complete for correct invocation.

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 description coverage is 100%, so the schema already documents all six parameters. The description adds value beyond the schema by explaining the semantics of the output_format values ('mermaid' for human-readable diagram, 'json' for agent/CI use with real FQNs), clarifying what include_external covers ('stdlib, third-party and unresolved call targets'), and noting that coverage/top_unresolved still counts dropped calls in json mode. It also explains the depth parameter's edge types. This goes beyond the baseline 3 for full schema coverage.

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 description opens with a precise definition: 'Downstream subgraph of one FQN: everything it reaches within depth hops.' It names the specific verb (trace), the resource (downstream subgraph of one FQN), and the edge types followed. It also explicitly distinguishes itself from siblings: cgis_analyze_impact for reverse dependencies, cgis_get_structure for members only, and cgis_context for a source-included brief. This is a model of sibling differentiation.

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?

The description gives explicit when-to-use guidance: 'this answers "what does X depend on?"' and then names the alternatives with their conditions: 'For what depends on X use cgis_analyze_impact; 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.' It also tells the agent to run cgis_ingest first if the database does not exist yet. This is complete usage guidance.

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