Skip to main content
Glama

QuickBuild agent tools (x402)

Rerank documents for a query

rerank_documents
Read-onlyIdempotent

[PAID $0.002 USDC per call via x402 on Base; errors are free] Cohere/Jina-style rerank: POST {query, documents: string[] | {text}[], top_n, return_documents} and get {results: [{index, relevance_score, document?}]} sorted by relevance. Models (Cloudflare Workers AI): bge-reranker-base (cross-encoder, English/Chinese, scores 0..1); bge-m3 (multilingual similarity scoring) (default bge-reranker-base; other names map to it). Up to 100 documents, each scored on its first 4000 chars; one fixed price per call. Use after vector search to pick the best passages for an LLM. Errors are never charged. All params optional: with none it ranks a small sample.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNoRerank model (default bge-reranker-base).
queryNoSearch query (max 2000 chars). Optional with documents omitted: a sample is ranked.
top_nNoReturn only the best N (default all).
documentsNoDocuments to rank: strings or {text} objects (max 100).
return_documentsNoInclude the document text in each result (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive), but the description adds substantial behavioral detail beyond them: cost per call, free errors, model-specific scoring behavior, the 100-document and 4000-character limits, default model mapping, and all-params-optional sample ranking. This is far richer than the annotations alone.

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?

It is dense and front-loads pricing and API shape before model details, with no filler sentences. Minor repetition ('errors are free' / 'Errors are never charged') and packed parentheticals keep it from a 5, but every clause carries real information.

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?

There is no output schema, so the description supplies the return shape itself ({results: [{index, relevance_score, document?}]}). Combined with pricing, model limits, truncation behavior, and optional-parameter behavior, an agent has everything needed to invoke the tool correctly.

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 100%, so the baseline is 3, but the description adds meaningful semantics beyond the schema: bge-reranker-base scores 0..1 for English/Chinese, bge-m3 is multilingual, unknown model names map to the default, and documents are scored only on their first 4000 characters. These details help an agent choose parameters correctly.

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 description names the exact operation (rerank documents for a query) and the specific mechanism (Cohere/Jina-style POST returning ranked relevance scores). It is immediately distinguishable from sibling tools like text_embeddings or llm_chat, so an agent knows this is a scoring/ranking endpoint, not generation or embedding.

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?

It explicitly says to use it 'after vector search to pick the best passages for an LLM,' which gives clear context for when this tool belongs in a pipeline. It does not state when not to use it or name alternative tools, but the usage context is unambiguous.

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