Skip to main content
Glama

Evaluate retrieval

evaluate_retrieval
Read-onlyIdempotent

Scores ranked retrieval results against qrels and returns recall, precision, nDCG, hit rate, and MRR at selected cut-offs, so you can check whether retrieval quality is sufficient.

Instructions

Score a ranked retrieval run against relevance judgements (qrels). Returns recall@k, precision@k, nDCG@k (graded, linear gain), hit rate@k and MRR, averaged over judged queries, plus per-query values. Use it to check whether one retriever is good enough; to choose between several, use compare_configs. Deterministic; no model calls.

Input Schema

NameRequiredDescriptionDefault
kNoCut-offs to evaluate. Defaults to [1, 3, 5, 10].
runYesRanked retrieval output: { queryId: [docId, ...] }, best match first. Example: { "q1": ["d7", "d3", "d9"] }
qrelsYesRelevance judgements: { queryId: { docId: grade } }. Grade 0 means not relevant; higher grades are more relevant (used by nDCG). Example: { "q1": { "d3": 2, "d7": 1 } }

Output Schema

NameRequiredDescriptionDefault
metricsYesMetric name to value, e.g. { "recall@5": 0.83, "mrr": 0.71 }
queriesYesQueries with at least one relevant document.
perQueryYes
missingFromRunYesJudged queries absent from the run (scored as an empty ranking).
skippedQueriesYesQueries in qrels with no relevant documents (excluded from averages).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, non-destructive, closed-world. The description adds genuinely new behavioral facts: determinism, no model calls, and that scores are averaged over judged queries with per-query values also returned. Minor gap: nothing about how unjudged queries or missing qrels entries are handled, which matters for interpreting the averages.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences: what it computes, how to use it versus the alternative, and its execution properties. Front-loaded with the core action and metrics; no filler.

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?

Complete for a three-parameter evaluation tool: outputs described, aggregation semantics stated, sibling routing explicit, and an output schema covers return structure. Nothing needed 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.

Parameters3/5

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

Schema coverage is 100%, with defaults for k and worked examples for both qrels and run documented in the schema. The description adds no parameter detail beyond that, so the baseline 3 applies.

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 (score a ranked retrieval run against qrels) and enumerates the exact metrics returned. It names the sibling tool it is not (compare_configs) so an agent can distinguish the two without opening schemas.

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 states when to use it ('check whether one retriever is good enough') and when to use the alternative ('to choose between several, use compare_configs'). No inference required.

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