Skip to main content
Glama

cluster

Read-onlyIdempotent

Detect communities in a typed-edge graph using Louvain modularity. Returns deterministic group IDs and member summaries to organize related notes.

Instructions

Community detection over the typed-edge graph via Louvain modularity (Blondel et al. 2008) using graphology + graphology-communities-louvain. Deterministic: same input produces byte-identical cluster_id assignment via DocId-sorted node insertion + seeded RNG (vault-memory-cluster-v1). cluster_id = smallest member DocId per community. Hard-capped at 5000 nodes; pass force: true to override. Either query (composes search_hybrid + expand 1-hop) OR seed_doc_ids (uses provided seeds + induced 1-hop neighborhood); not both — passing both returns {ok:false, reason:'both_seeds_and_query'}. On the query path with multiple vaults configured, the vault field is required so search scope is deterministic; single-vault setups may omit it (returns {ok:false, reason:'vault_required'} otherwise). Returns per-cluster {cluster_id, size, members[], summary: {top_types, top_titles, edge_density}}. No LLM enrichment — summary fields are pure-deterministic computations (LLM enrichment is Phase 5 brief layer's job). _memory opacity inherited from expand() (Plan 04-03).

Input Schema

NameRequiredDescriptionDefault
forceNo
queryNo
vaultNo
methodYes
query_top_kNo
seed_doc_idsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0-rc.5

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations by disclosing deterministic byte-identical assignment, the seeded RNG tag, cluster_id derivation, the 5000-node hard cap, exact error reasons, and that summaries are pure computations with no LLM enrichment.

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?

Dense but front-loaded, with the algorithm and determinism guarantees stated first and the path rules following. The parenthetical citation and library/plan references add minor noise but each sentence conveys operative detail.

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 complex tool with 6 params, 0% schema coverage, and no output schema, it fully describes the return shape ({cluster_id, size, members[], summary}) and all routing constraints. 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 0%, so the description carries the burden; it explains the query/seed_doc_ids exclusivity, vault requirement, and force override. It does not explain query_top_k's role or the method const, leaving those only visible in 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 operation (community detection over the typed-edge graph) with the exact algorithm (Louvain modularity) and libraries used. It distinguishes itself from siblings by naming search_hybrid and expand as components of its own query path rather than alternatives.

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?

Explicitly defines the two mutually exclusive input paths (query vs seed_doc_ids), states that passing both returns an error, and specifies that vault is required on the query path when multiple vaults exist. It also states the force override condition for the 5000-node cap.

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