mcp-reranker mcp

v1.0.0 · MCP Tool · ai · registry.pascalai.org

Rerank a list of documents or passages by relevance to a query. Uses LLM-based scoring via MakerAI (CompleteStructured with scoring schema) or cross-encoder models. Essential second stage in RAG pipelines to improve precision.

rerankerragrelevancerankingretrieval

MakerAI Pipeline

Input Parameters

ParameterTypeDescription
queryrequired string The search query or question.
documentsrequired array[object] List of documents/passages to rerank.
top_koptional integer Return only the top K results after reranking. Default: returns all. Default: 0.
methodoptional string Reranking method. Default: 'llm_pointwise'. One of: llm_pointwise, llm_pairwise, cohere_rerank. Default: llm_pointwise.
modeloptional string Model for LLM-based reranking. Empty = router default.

Output Fields

FieldTypeDescription
query string
results array[object] Reranked documents with relevance scores, best first.
method string
model string

Examples

Rerank RAG retrieved chunks

// Input
{
  "query": "How do I configure SSL in Nginx?",
  "documents": [
    {
      "id": "a",
      "content": "SSL configuration in Apache uses mod_ssl."
    },
    {
      "id": "b",
      "content": "To enable SSL in Nginx, add ssl_certificate and ssl_certificate_key directives."
    },
    {
      "id": "c",
      "content": "Nginx is a high-performance web server."
    }
  ],
  "top_k": 2
}

// Output
{
  "results": [
    {
      "id": "b",
      "content": "To enable SSL in Nginx...",
      "score": 0.97,
      "rank": 1
    },
    {
      "id": "c",
      "content": "Nginx is a high-performance...",
      "score": 0.41,
      "rank": 2
    }
  ]
}

Install & Discovery

Install

ppm install mcp-reranker

Get JSON Schema

GET /v1/packages/mcp-reranker/1.0.0/schema

Discover by keyword

GET /v1/mcp/discover?q=reranker
Discovery hint: Install with ppm install mcp-reranker or invoke remotely via POST /v1/invoke/mcp-reranker on the MCP Service.

PascalAI Usage

uses toolslib;
var Tool := LoadTool('mcp-reranker');
var R := Tool.Call(JsonObj(['query',q,'documents',docs,'top_k',3]));
for var Item in R['results'] do Writeln(Item['id'] + ': ' + FloatToStr(Item['score']));