Skip to main content
Glama

Rerank documents

rerank_documents

Reranks documents by relevance to a query using semantic similarity, returning results ordered by score. Use it to improve search, retrieval, or RAG ranking quality.

Instructions

Reranks documents by relevance to a query using semantic similarity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesReranker model to use
queryYesQuery to rank against
top_nNoNumber of results to return
documentsYesDocuments to rerank
return_documentsNo
X-TokenLab-Delivery-PolicyNoPer-request Delivery policy. Overrides the API key and Workspace defaults. Auto tries TokenLab Veri…

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.6.24
    • addedInput schema / properties / X-TokenLab-Delivery-Policy
      Added value: +{
      +  "description": "Per-request Delivery policy. Overrides the API key and Workspace defaults. Auto tries TokenLab Veri…",
      +  "enum": [
      +    "auto",
      +    "verified",
      +    "official"
      +  ],
      +  "type": "string"
      +}
  2. Changed3 schema fields changedv0.6.4
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / properties / top_n / maximum
      Removed value: -9007199254740991
    • removedInput schema / properties / top_n / minimum
      Removed value: --9007199254740991
  3. Addedv0.3.1

TDQS

C2.9/5.0
Behavior2/5

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

Annotations declare readOnlyHint=false and idempotentHint=false but give no real safety detail, so the description carries most of the burden. It adds only 'semantic similarity' as mechanism and says nothing about ordering guarantees, what the response contains, or why a purely computational rerank is flagged non-read-only.

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?

A single efficient sentence with the core action front-loaded and no filler. It is well-sized, though it omits anything beyond the bare action.

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

Completeness2/5

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

With 6 parameters, no output schema, and no return-value documentation, the description is too thin. An agent cannot tell what the reranked output looks like (ranked list, scores, whether documents are echoed) or how top_n/return_documents interact.

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 83%, so the schema already documents model, query, top_n, and documents. The description adds no per-parameter detail (e.g. default top_n behavior, what return_documents does) beyond what the schema provides, so the baseline 3 applies.

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?

States a specific verb ('reranks'), resource ('documents'), and the mechanism ('by relevance to a query using semantic similarity'). However, it makes no attempt to distinguish itself from adjacent siblings like create_embedding, so it stops short of a 5.

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

Usage Guidelines2/5

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

There is no when-to-use guidance, no prerequisites, and no named alternative. It never tells the agent when reranking is preferable to embedding or plain retrieval, nor when not to use it.

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