Skip to main content
Glama

Rerank Documents

rerank_documents

Ranks candidate documents by relevance to a query, returning scores and original positions to surface the most pertinent results for retrieval-augmented generation.

Instructions

Order documents by how well they answer a query, with Qwen3-Reranker-8B (NaN API). This is the second half of a RAG pipeline: embed_text builds the vectors a search runs over, and this one ranks what that search returns. Returns one line per document with its relevance score and its position in the input list, in the order the reranker gives them back.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesQuery against which each document's relevance is measured
top_nNoLimit response to the N most relevant documents
documentsYesCandidate texts to re-rank, typically the top hits of a vector search

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.0

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations provided, the description carries the burden of disclosing behavior. It mentions the underlying model (Qwen3-Reranker-8B) and the output format (one line per document with relevance score and position), which adds value beyond the schema. However, it does not disclose potential rate limits, error handling, or whether the input order is preserved in case of ties. The description provides average behavioral detail for a tool with no annotations.

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 description is reasonably concise and front-loaded with the main purpose. It introduces the RAG pipeline context and the output format in a few sentences. There is minimal redundancy; each sentence earns its place. The description could be slightly trimmed, but it remains well-structured and informative.

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?

Given the tool's moderate complexity (3 parameters, no output schema) and the rich schema coverage, the description provides sufficient context for an agent to invoke it correctly. It explains the tool's role in the pipeline, the output format, and parameter semantics. The absence of an output schema is mitigated by the description's return value explanation. Minor gaps include missing error behavior or edge cases, but overall it is complete enough.

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 three parameters: query, documents, and top_n. The description adds context about the 'documents' parameter by noting it's typically the top hits of a vector search, which is helpful but not extensive. Since the schema is thorough, a baseline of 3 is appropriate; the description adds marginal value beyond the schema.

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 clearly states the tool's purpose: ordering documents by relevance to a query using a specific reranker model. It identifies the resources (documents, query) and the action (rerank), and distinguishes it from sibling tools like embed_text and search-related tools. The context of being part of a RAG pipeline further clarifies its role.

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 provides clear context for when to use this tool: as the second half of a RAG pipeline, after embed_text builds vectors and search returns hits. It mentions the relationship to embed_text, but does not explicitly state when NOT to use it or name alternative reranking tools. The usage is implied strongly, yet lacks explicit alternatives or exclusions.

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