Skip to main content
Glama

Community measurements (Leiden partition)

codetopo_communities
Read-only

Partitions an indexed code dependency graph into Leiden communities, returning community sizes, internal and cut edge counts, modularity, and node assignments to reveal code clusters.

Instructions

The Leiden partition of the dependency graph (Traag et al. 2019; modularity quality, resolution 1.0, fixed published seed) over the undirected CODE_SCHEMA section 9 projection weighted by edge multiplicity: community count, the partition's modularity Q (absent when the graph has no edges), per-community sizes and internal/cut edge counts, and node assignments (limit caps the assignment list; summaries are always full and truncation is stated). Measurements with a stated method - no thresholds, no verdicts.

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum assignments to return. Default 20.
db_pathYesPath to the index database.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already cover the read-only/non-destructive profile, so the description's added value is the determinism contract (fixed published seed, resolution 1.0), the documented edge case (modularity Q absent when the graph has no edges), and truncation semantics ('summaries are always full and truncation is stated'). That is real behavioral context beyond the annotations, though it omits any note on cost or runtime for large graphs.

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 method and resource, then the return contents, then the limit caveat — a logical order. It is dense with parentheticals but every clause carries information; the trailing tagline 'Measurements with a stated method - no thresholds, no verdicts' is the weakest element, mostly restating intent.

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?

No output schema exists, and the description compensates by enumerating the return payload: community count, modularity Q, per-community sizes and internal/cut edge counts, and node assignments. Combined with the noted edge case and truncation rule, an agent has everything needed to call it and interpret results.

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?

With 100% schema coverage the baseline is 3, but the description adds meaning the schema does not: 'limit caps the assignment list; summaries are always full and truncation is stated' tells the agent exactly what limit does and does not truncate. The db_path parameter is left entirely to the schema.

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?

States a specific analytical verb and resource: 'The Leiden partition of the dependency graph', pinned to a named algorithm with citation, resolution, and seed. It also names the exact projection (undirected CODE_SCHEMA section 9, multiplicity-weighted), which distinguishes it from sibling measurement tools like codetopo_metrics or codetopo_stats.

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

Usage Guidelines3/5

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

Usage is implied by the content — you call it when you want community structure — and the closing line 'no thresholds, no verdicts' hints at the measurement-only contract. But there is no explicit when-to-use versus alternatives (e.g., codetopo_metrics, codetopo_rank) statement, so the agent must infer selection.

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