Skip to main content
Glama

cgis_trace_flow

Trace downstream dependencies of a fully qualified name through calls, imports, inheritance, DI and references to answer what X depends on, with configurable depth and output.

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``.

Test code is left out unless ``include_tests`` asks for it, and at most
``max_nodes`` nodes come back, nearest first, as for impact.

``output_format="text"`` returns the subgraph as an indented tree, one line
per node with children in call-site order, so a flow reads top down — about
a fifth of the json for the same answer; ``"mermaid"`` (default) a diagram;
``"json"`` 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

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). A hop from a base or interface method to its overrides costs no depth.
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 downstream, over calls, imports, inheritance, DI dependencies and references (plus containment with include_structure)."New value: +"Maximum edge hops downstream, over calls, imports, inheritance, DI dependencies and references (plus containment with include_structure). A hop from a base or interface method to its overrides costs no depth."
  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 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"
      +}
  4. 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."
  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 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."
  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?

With no annotations, the description carries the whole burden and does so: it discloses that containment edges are skipped by default, that tests/external/unresolved targets are dropped by default, that results are truncated at max_nodes with the walk stopping mid-level, that rounded coverage counts can be misleading in Python, and that an unknown output_format returns an error. That is unusually rich behavioral context for an analysis tool.

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?

Front-loaded: the first sentence defines the tool, then routing to siblings, then option semantics. However, it re-explains several parameters (output_format, max_nodes, include_tests) that already have 100%-covered schema descriptions, adding length without new information. Still readable and every section is relevant.

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 an output schema exists, return-shape detail is optional, yet the description clarifies the json payload ('joinable {root, nodes, edges, coverage}'), what coverage counts and how to read top_unresolved. Combined with edge-type and default-exclusion coverage, an agent has everything needed to invoke it correctly.

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 the baseline is 3; the description goes further by giving the tradeoff behind output_format ('about a fifth of the json for the same answer'), explaining that max_nodes truncation reports where the cut fell, and clarifying that include_external covers stdlib, third-party and unresolved call targets. It largely restates rather than extends the schema on the boolean flags, so it is above baseline but not maximal.

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?

Opens with a specific verb+resource and scope: 'Downstream subgraph of one FQN: everything it reaches within depth hops.' It then enumerates exactly which edge kinds are followed and which are excluded, and explicitly names the sibling tools for adjacent questions (cgis_analyze_impact, cgis_get_structure, cgis_context). An agent can distinguish it from every sibling without opening a schema.

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?

Gives explicit routing rules: '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... cgis_context.' It also states the prerequisite ('Use cgis_ingest first if the database does not exist yet') and the default-exclusion conditions that select the include_* flags.

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