Skip to main content
Glama

Diogenes Context Compression, Code Patching & Deterministic Solver MCP

Okapi BM25 + Reciprocal Rank Fusion (RRF) + MMR Chunk Reranker

rerank_hybrid_rag_chunks
Read-onlyIdempotent

Reranks and deduplicates candidate RAG or retrieval passages against a search prompt using Okapi BM25 (k1=1.5, b=0.75), Reciprocal Rank Fusion (RRF), and Maximal Marginal Relevance (MMR) Jaccard diversity filtering. Use when selecting the top-K highest-signal, non-redundant passages from vector search or grep results; for compressing a single contiguous source file while keeping its original line order, use prune_context_skeleton instead. Read-only edge call (32 KB, 60 RPM): accepts 'search_prompt' ('documents_json' defaults to 'standard'), uses '?demo=true' or L402 (15 sats); HTTP 400 if invalid.

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": {
      "search_prompt": "<search_prompt>",
      "documents_json": "<documents_json>"
    },
    "name": "rerank_hybrid_rag_chunks"
  }
}

Input Schema

NameRequiredDescriptionDefault
top_kNoMaximum number of deduplicated chunks to return; defaults to 5 when omitted.
ranking_modeNoFusion weighting between lexical BM25 and diversity penalty; defaults to 'bm25_rrf_mmr' when omitted.
search_promptYesTechnical search prompt or question used to score candidate chunks.
documents_jsonYesJSON string or array of candidate chunks '[{"id":"c1","text":"..."}]' to rerank.

Output Schema

NameRequiredDescriptionDefault
queryYesEvaluated search query.
ranked_chunksYesOrdered top-K chunks with bm25_score, rrf_score, and mmr_score.
returned_countYesNumber of deduplicated top-K chunks returned.
total_candidatesYesNumber of input candidate chunks scored.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • removedInput schema / properties / query
      Removed value: -{
      -  "description": "Technical search query or question used to score candidate chunks.",
      -  "type": "string"
      -}
    • addedInput schema / properties / search_prompt
      Added value: +{
      +  "description": "Technical search prompt or question used to score candidate chunks.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "query",
      -  "documents_json"
      -]New value: +[
      +  "search_prompt",
      +  "documents_json"
      +]
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description layers on operationally critical facts the annotations cannot express: a 32 KB payload ceiling, 60 RPM rate limit, auth path ('?demo=true' or L402 at 15 sats), and HTTP 400 on invalid input. That is exactly the extra context an agent needs before invoking.

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?

Front-loads the what/why in the first sentence and the routing rule in the second, with operational constraints last. Dense but largely earned; the algorithm hyperparameters (k1=1.5, b=0.75) are arguably more detail than a selector needs.

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?

With an output schema present the description need not explain return values, and it covers limits, auth, error behavior and sibling routing. The only soft spot is the unclear documents_json 'standard' default, which leaves the input format slightly under-specified.

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 coverage is 100%, so the schema already documents top_k, ranking_mode, search_prompt and documents_json, and the description adds little beyond naming 'search_prompt' and referencing top-K. The parenthetical "'documents_json' defaults to 'standard'" is ambiguous and could mislead about the parameter's expected value, so no credit above baseline.

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?

Names a specific verb and resource (reranks/deduplicates candidate RAG passages) plus the exact techniques used (BM25 k1=1.5/b=0.75, RRF, MMR Jaccard). It explicitly contrasts itself with the nearest sibling, prune_context_skeleton, so an agent can distinguish the two without opening either schema.

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

Usage Guidelines5/5

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

Gives an explicit trigger ('selecting the top-K highest-signal, non-redundant passages from vector search or grep results') and an explicit exclusion routing to prune_context_skeleton for compressing a single contiguous file in original line order. Both when-to-use and the alternative are stated.

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