Skip to main content
Glama

rerank_documents

Rerank retrieved documents by relevance to a query with a cross-encoder (bge-reranker-base), the last step of a RAG or search pipeline: send a query and up to 100 documents (strings or {id, text}) and get them back best first with 0-1 relevance scores. Cohere-style output (index, relevance_score, document); top_n and min_score filters. One flat price per call. Costs $0.003 USDC on Base via x402.

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_documents"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesWhat the documents should answer
top_nNoReturn only the best n (default all)
documentsYesUp to 100 strings or {id, text} objects
min_scoreNoDrop results scoring below this
return_documentsNoInclude each document's text, first 500 characters (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations to lean on, the description carries the behavioral load well: result ordering (best first), score range (0-1), output field shape (index, relevance_score, document), the 100-document cap, and the payment model (one flat $0.003 USDC per call on Base via x402) which is essential auth/cost context an agent must know before invoking. It omits failure modes, latency, and what happens on oversized inputs.

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 action and model, then colon-appended detail on inputs, outputs, and pricing. Dense but nearly every clause earns its place; the run-on structure is the only mild weakness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description must describe returns — and it does (ordered list, relevance scores, per-document fields, optional text inclusion via return_documents). Payment rail and cost are covered. Only error/limit behavior and rate/throughput expectations are left implicit.

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 coverage is already 100%, but the description still adds value: it clarifies that documents may be plain strings or {id, text} objects, and it ties top_n/min_score to a concrete output contract (Cohere-style index/relevance_score/document) rather than restating parameter prose. The 0-1 score range gives min_score a meaningful scale 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+resource (rerank documents by relevance to a query), names the underlying cross-encoder (bge-reranker-base), and positions the tool as 'the last step of a RAG or search pipeline'. That positioning implicitly separates it from the embedding-generation siblings (ai_embeddings) without needing to name them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clearly signals the stage at which to call it ('the last step of a RAG or search pipeline') and what to send (a query plus up to 100 documents). It does not state explicit exclusions, such as when to skip reranking or what to use if you only have a query and a raw corpus.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources