Skip to main content
Glama

search_similar

Find documents semantically similar to an indexed reference document by comparing embeddings. Returns related filepaths and similarity scores for thematic discovery.

Instructions

Find documents semantically similar to a given reference document.

Read-only. No side effects. Uses the document's embedding for similarity comparison.

Args: filepath: Path to the reference document (must already be indexed — list_documents() lists indexed paths, one page at a time). E.g., "security/technique.md" max_results: Number of similar documents to return (default: 5, max: 20)

Returns: JSON string with list of similar document filepaths and similarity scores (0.0–1.0).

Usage: Use when you have a specific document and want to discover thematically related ones. Use search_knowledge() instead when you have a text query rather than a reference document. The reference document must be indexed; list_documents() lists indexed paths one page at a time.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "filepath": "<filepath>"
    },
    "name": "search_similar"
  }
}

Input Schema

NameRequiredDescriptionDefault
filepathYes
max_resultsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.0

TDQS

A4.6/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full load and does well: it declares 'Read-only. No side effects.', explains the embedding-based comparison mechanism, and documents the similarity score range. It omits edge cases such as behavior when the filepath is not indexed (error vs. empty result), which keeps it below a 5.

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 core purpose and safety profile, then organized into Args/Returns/Usage sections. It is somewhat repetitive, restating that the reference document must be indexed twice and that list_documents() pages results twice, which is minor waste.

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?

An output schema exists, so return values need minimal explanation, yet the description still summarizes filepaths and 0.0–1.0 scores. Combined with the precondition, alternative routing, and parameter bounds, an agent has everything needed to call this 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 description coverage is 0%, so the description must compensate, and it does: it gives filepath format and example ('security/technique.md'), notes it must already be indexed, and supplies max_results defaults and bounds (default 5, max 20) that the schema lacks.

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 verb and resource ('Find documents semantically similar to a given reference document') and adds mechanism ('Uses the document's embedding for similarity comparison'), which distinguishes it from sibling search_knowledge.

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 names the alternative: 'Use search_knowledge() instead when you have a text query rather than a reference document.' It also states the precondition that the reference document must be indexed and points to list_documents() for discovering paths.

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