Skip to main content
Glama

Rank passages by relevance

rerank
Read-only

Orders candidate passages by how well they answer a query using a local cross-encoder, returning each passage best-first with relevance scores and original indexes.

Instructions

Order passages you already have by how well each answers a query, with a cross-encoder, locally. Returns every passage best first, each with its original index in documents, a relevance from 0 to 1 and its start. Use it on search results or a shortlist of tens of passages; to find passages in files use search_folder, and to score just two texts use similarity. Slower per passage than similarity but more precise.

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": {
      "query": "<query>",
      "documents": "<documents>"
    },
    "name": "rerank"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe question or need the passages should answer.
documentsYesThe candidate passages, each a sentence to a few paragraphs; longer ones are cut off.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.8.5
    • addedInput schema / properties / documents / description
      Added value: +"The candidate passages, each a sentence to a few paragraphs; longer ones are cut off."
    • addedInput schema / properties / query / description
      Added value: +"The question or need the passages should answer."
  2. First observedv0.8.2

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint, so the description carries the real behavioral load: it discloses the return shape (every passage, best first, with original index, a 0-1 relevance, and a start offset), notes the local cross-encoder execution model, and warns about the precision/latency trade-off. That is more than the annotations could ever convey.

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 sentences, front-loaded with the core action, then routing, then the cost/precision note. Every clause earns its place and nothing is repeated from the schema or annotations.

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?

With no output schema, the description steps in and describes the return fields directly, and it bounds the scale of a sensible input ('tens of passages'). For a two-parameter read-only tool this leaves nothing an agent needs for correct invocation.

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 description coverage is 100%, so query and documents are already documented, including truncation of longer passages. The description's phrase 'passages you already have' usefully confirms documents are text, not file references, but adds little else about the parameters themselves; 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 ('order passages ... by how well each answers a query') plus the mechanism ('cross-encoder, locally'). It also draws a bright line against the two nearest siblings, so an agent can select it without opening either schema.

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?

Gives explicit when-to-use context ('on search results or a shortlist of tens of passages') and names both alternatives with the condition that selects each: search_folder for locating passages in files, similarity for scoring just two texts. It even states the trade-off ('slower per passage than similarity but more precise') that would resolve a tie.

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