Skip to main content
Glama

evaluate_retrieval

Tests retrieval quality by running query cases and checking whether expected documents appear in top-5 results, then reports MRR@5 and Recall@5 for auditing.

Instructions

Evaluate search quality by testing whether search_knowledge() retrieves expected documents.

Read-only. Runs multiple search queries internally. No side effects on the index.

Args: test_cases: JSON string array of test cases. Each item requires "query" (search string) and "expected_filepath" (path of the document that should appear in top-5 results). Example: [{"query": "suid exploit", "expected_filepath": "security/suid.md"}]

Returns: JSON string with MRR@5 (Mean Reciprocal Rank), Recall@5, and per-query hit/miss breakdown. MRR@5 above 0.7 indicates good retrieval quality.

Usage: Use to audit search quality after bulk document ingestion, a model change or a reindex. Each case runs as one top-5 search with the defaults of search_knowledge() (hybrid_alpha 0.3, search_method auto, no category or folder filter), so the figures describe what a client gets when it passes no options; this tool takes no search options. Use get_index_stats() for system health checks instead. Use search_knowledge() for actual document retrieval — this tool is for quality measurement only.

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": {
      "test_cases": "<test_cases>"
    },
    "name": "evaluate_retrieval"
  }
}

Input Schema

NameRequiredDescriptionDefault
test_casesYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.0

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations, the description does the heavy lifting: read-only, no index side effects, and multiple search queries executed internally. It also discloses the crucial behavioral caveat that every case runs with search_knowledge() defaults (hybrid_alpha 0.3, auto method, no filters) and that it accepts no search options. It does not mention runtime cost or any cap on the number of test cases, which is the one gap.

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 purpose and safety, then Args/Returns/Usage sections; every part is scannable. There is minor redundancy in restating that the tool 'takes no search options' after already listing the fixed defaults, and the return-value paragraph partly duplicates the output schema.

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 one-parameter measurement tool, the definition covers what it does, the exact input format, what metrics come back and how to read them (MRR@5 above 0.7 is good), and how it relates to sibling tools. An agent can call it correctly without opening the schema.

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 coverage is 0% — the schema only says 'test_cases' is a string — so the description must compensate, and it does: it specifies a JSON string array, the two required keys per item ('query' and 'expected_filepath'), the top-5 matching semantics of expected_filepath, and a concrete example.

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?

The first sentence names a specific verb (evaluate) and specific resource (retrieval quality of search_knowledge) and frames it as a measurement tool rather than a retrieval tool. This clearly separates it from search_knowledge and get_index_stats.

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?

It states exactly when to use it (after bulk ingestion, a model change, or a reindex) and explicitly routes away two alternatives: get_index_stats for system health and search_knowledge for actual document retrieval. The exclusion 'this tool is for quality measurement only' removes ambiguity.

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