Skip to main content
Glama

cgis_suggest_packages

Suggests sub-package boundaries for a Python or TypeScript package by clustering its dependency communities, returning a verdict to split, consolidate, or leave the layout aligned.

Instructions

Suggest sub-package boundaries for a package from its dependency communities.

Returns JSON: modularity_q, divergence, direction (under/over/matched),
verdict (split/consolidate/aligned/leave/borderline/no_signal), the detected
communities (id + members), the cross-community bridge edges (cost of
splitting), and the thresholds used. Default layer is IMPORTS; set
``with_calls`` for the combined import+call graph. Run ``cgis_ingest`` first.

Members are the package's direct children by default, each sub-package one
node, so the verdict says whether to regroup them; ``level`` in the result
says which. ``all_descendants`` clusters every file below the package.

A mis-rooted graph (import targets resolve to no internal file) returns
``no_signal`` with a diagnostic note rather than a silent clean verdict.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
min_qNoModularity threshold: at or above it, a package whose layout disagrees with its communities is flagged split (or consolidate, if over-split).
prefixNoFQN prefix of the package to analyse, e.g. cgis.query, matched on whole dot-segments. Needed in practice: without it the verdict is no_signal.
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
with_callsNoUse the combined import + call graph instead of imports only.
all_descendantsNoCluster every file below the package and compare with its sub-directories, instead of treating each sub-package as one node.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.21.9
    • addedInput schema / properties / all_descendants
      Added value: +{
      +  "default": false,
      +  "description": "Cluster every file below the package and compare with its sub-directories, instead of treating each sub-package as one node.",
      +  "title": "All Descendants",
      +  "type": "boolean"
      +}
  2. 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 / min_q / description
      Added value: +"Modularity threshold: at or above it, a package whose layout disagrees with its communities is flagged split (or consolidate, if over-split)."
    • addedInput schema / properties / prefix / description
      Added value: +"FQN prefix of the package to analyse, e.g. cgis.query, matched on whole dot-segments. Needed in practice: without it the verdict is no_signal."
    • addedInput schema / properties / with_calls / description
      Added value: +"Use the combined import + call graph instead of imports only."
  3. First observedv0.21.0

TDQS

A4.1/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses the JSON payload shape, the default layer, the recursive all_descendants mode, and notably the failure mode that a mis-rooted graph returns no_signal with a diagnostic note rather than a silent clean verdict. That edge-case disclosure is exactly the kind of behavior an agent needs before trusting the output.

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 with the purpose, then the return shape, then the configuration and precondition. Efficient overall, but the detailed return-field enumeration duplicates what the output schema already carries, which is some wasted space.

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

Completeness4/5

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

Preconditions (cgis_ingest first, prefix needed in practice) and failure behavior are covered, which is what the agent needs to call it correctly. Since an output schema exists, the lengthy return-value listing is partly redundant but not harmful.

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

Parameters3/5

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

Schema description coverage is 100%, so the parameters (min_q, prefix, db_path, with_calls, all_descendants) are already documented in the schema. The description mostly restates those semantics (with_calls, all_descendants) rather than adding syntax or format detail, so the baseline 3 is appropriate.

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

Purpose4/5

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

States a specific verb and resource: 'Suggest sub-package boundaries for a package from its dependency communities.' This is clearly distinguishable from analysis siblings like cgis_metrics or cgis_get_structure, but no sibling is named or contrasted, so it falls short of the top band.

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

Usage Guidelines4/5

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

Gives a clear prerequisite ('Run cgis_ingest first') and the layering choice ('Default layer is IMPORTS; set with_calls for the combined import+call graph'), so an agent knows how to configure it. It never states when to prefer this over a sibling tool (e.g. cgis_fractal), so no exclusions or alternatives are offered.

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