Skip to main content
Glama

text_rerank

Rerank search results or RAG chunks by relevance to a query: JSON body {query, documents, top_k}. Up to 50 documents (strings or {id, text}), each up to 2,000 chars. Returns the documents sorted by a 0-1 relevance score from the bge-reranker-base cross-encoder. Texts are not stored. Price $0.005 USDC per call via x402. Example output: {"documents":3,"returned":2,"model":"baai/bge-reranker-base","results":[{"rank":1,"index":0,"score":0.9312,"text":"Photosynthesis turns light, water and carbon dioxide into sugar."},{"rank":2,"index":2,"score":0.4105,"text":"Chlorophyll absorbs sunlight in leaves."}]}

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": "text_rerank"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesSearch query, max 1,000 characters
top_kNoOptional number of results, default all
documentsYes1 to 50 strings or {id, text} objects, each max 2,000 characters
return_documentsNoOptional, default true

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and does so well: it discloses document limits, that texts are not stored, the pricing via x402, the scoring model, and an example output. This gives the agent substantial operational context beyond the schema.

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?

The purpose is front-loaded and the sentences are informative, including limits and pricing. The example output is somewhat long but earns its place because there is no 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 stateless reranking tool with no annotations or output schema, the description supplies the key operational details: request shape, size limits, privacy behavior, pricing, model identity, and example output. An agent has enough information to invoke it correctly.

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 the schema already documents all four parameters. The description restates the JSON body shape and some document format details, but it does not explain return_documents or add much beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: rerank search results or RAG chunks by relevance to a query. It does not explicitly distinguish this from the sibling text_similarity tool, so it falls short of the top score.

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?

The description gives clear context for when to use it: reranking search results or RAG chunks by query relevance. It does not name alternatives or when-not-to-use conditions, which keeps it below a 5.

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