Skip to main content
Glama

Find related documents

find_related

Find documents semantically related to an existing specification by type/id, ranked by local embedding similarity. Filter results by target document types or minimum score.

Instructions

Find the documents most semantically related to an existing document, given its type/id, ranked by cosine similarity of local sentence embeddings (fastembed/bge-small, the similarity extra). By default every whole-body domain is searched (req, uc, tsk, qa, prb, gol, rsk, dec, sop, feat, vcr, sysrs; adr is excluded structurally) -- restrict with target_types; the source document itself is excluded from the results. Returns up to top_k (default 10, validated 1..100) hits as {type, id, title, status, path, score} rows, sorted by score descending; min_score (default: no filter) is an inclusive cosine lower bound. An unparseable candidate still appears, embedded from its full raw text, with id = null and the <failed to parse> marker title/status. When the embedding feature is unavailable (SPECMGR_SIMILARITY_DISABLED present, or the backend/model fails to load), returns the structured {available: false, reason, message} result instead of raising. A bad type/id/target_types/top_k is a ValueError before any filesystem access; a missing source is the domain's own XNotFoundError.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
typeYes
top_kNo
min_scoreNo
target_typesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.36.0

TDQS

A4.3/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 thoroughly: it discloses the embedding backend, the feature-disabled path returning `{available: false, reason, message}` instead of raising, error semantics (`ValueError` before any filesystem access for bad args, the domain's `XNotFoundError` for a missing source), the unparseable-candidate edge case (`id = null`, `<failed to parse>` marker), and the sorted/excluded result behavior.

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?

Purpose and scope are front-loaded in the first sentence, followed by filtering, result shape, edge cases, and error behavior in a sane order. It is a dense single block with no visual structure, and a few clauses (e.g., the backend name) are borderline detail, but nearly every sentence earns its place.

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 5-parameter similarity-search tool with an output schema, the description covers invocation constraints, defaults, filtering, failure modes, and the feature-disabled return path. Even though an output schema exists, the row shape is described as a bonus. Nothing an agent needs to call it correctly is missing.

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

Parameters5/5

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

Schema description coverage is 0%, so the description had to compensate and largely does: `top_k` is documented with its default and validated 1..100 range, `min_score` as an inclusive cosine lower bound with no default filter, `target_types` as the restriction mechanism, and `type`/`id` as the source identifier. This is meaning well beyond the bare schema property names.

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 ('Find the documents most semantically related to an existing document, given its type/id') plus the ranking basis (cosine similarity of local sentence embeddings). Very clear what it does. It does not, however, explicitly differentiate itself from the sibling find_similar_text (doc-to-doc vs. text-query search), so an agent could still hesitate between the two.

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?

The description gives useful scoping context: by default all whole-body domains are searched, `adr` is structurally excluded, the source doc is omitted, and `target_types` narrows the search. But it never states when to prefer this over find_similar_text or any other alternative, nor describes exclusions like 'use X instead when you only have raw text'.

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