Skip to main content
Glama

cgis_get_structure

Display the containment hierarchy for a code symbol, listing contained modules, classes, and methods as a Mermaid diagram or JSON.

Instructions

Members of a module or class — or, for a package prefix, the modules it holds.

Follows containment (CONTAINS/DECLARES) only, so no call or import appears.
A package is not a node in the graph (#487), so its row and the edges to its
modules are synthesized for the answer and marked with a virtual file path.
For how the code connects use ``cgis_trace_flow`` (what it depends on) or
``cgis_analyze_impact`` (what depends on it).

Matches the CLI ``structure`` command. ``output_format="mermaid"`` (default) returns a
diagram of the hierarchy rooted at the given FQN; ``"json"`` returns the
joinable ``{root, nodes, edges}`` payload with real FQNs.

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 containment levels to descend (module → class → method).
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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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 containment levels to descend (module → class → method)."
    • 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."
  2. First observedv0.21.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden, and it does so thoroughly: package nodes are synthesized with virtual file paths, the output shape depends on output_format, and it matches the CLI structure command. It discloses notable edge cases such as packages not being graph nodes.

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

Conciseness5/5

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

The description is front-loaded with a crisp one-line definition, followed by scope constraints, alternatives, and output details. Every sentence earns its place; even the package-node nuance and sibling references are necessary for correct invocation.

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 a tool with no annotations, sample schema descriptions, and an output schema indicated, the description covers the important behaviors, alternatives, and parameter-specific output semantics. Nothing needed for correct selection or invocation 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 the schema already describes all four parameters well. The description adds extra meaning beyond the schema for output_format by specifying the JSON payload as 'joinable {root, nodes, edges}' and clarifying that the mermaid diagram is rooted at the given FQN.

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 names a specific verb+resource: it returns members of a module/class or modules held by a package prefix, and explicitly states it follows containment only. It distinguishes itself from cgis_trace_flow and cgis_analyze_impact by name, so an agent can select the correct tool without inspecting the 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?

It explicitly states when to use alternatives: use cgis_trace_flow for dependencies or cgis_analyze_impact for dependents when code connectivity is the question. It also clarifies containment-only semantics (no calls/imports), which defines the boundary of this tool's scope.

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