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 (50 sats); HTTP 400 if invalid.

Input Schema

TableJSON 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

TableJSON 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.4/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, and openWorldHint=false, so the safety profile is covered. The description adds operational context beyond the annotations: 32 KB payload limit, 60 RPM rate limit, auth via '?demo=true' or L402 (50 sats), and HTTP 400 on invalid input. These are exactly the behavioral details an agent cannot infer from structured fields.

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 front-loaded with the core purpose and algorithm details, then moves to usage and alternatives, then operational constraints. Every sentence is informative, though the parenthetical about 'documents_json' defaulting to 'standard' is cryptic and slightly harms readability. It is appropriately sized for a tool of this complexity.

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 rich annotations, full schema coverage, and an output schema, the description covers purpose, usage, alternatives, and operational limits well. The only gap is the inconsistent statement about 'documents_json' defaulting to 'standard,' which conflicts with the schema's required parameter and could confuse invocation. Otherwise, nothing essential for correct tool use is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3, but the description adds a potentially misleading claim: it says 'documents_json' defaults to 'standard' even though the schema marks 'documents_json' as required and does not specify a default. This could cause an agent to omit a required parameter and receive an error. The description otherwise adds little parameter meaning beyond the already complete 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?

States a specific verb and resource: 'Reranks and deduplicates candidate RAG or retrieval passages against a search prompt.' It names the exact algorithms used (Okapi BM25, RRF, MMR Jaccard) and distinguishes itself from the sibling prune_context_skeleton. An agent can identify the tool's function without opening the 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?

Explicitly says to use it 'when selecting the top-K highest-signal, non-redundant passages from vector search or grep results.' It also names the alternative tool and the condition that selects it: 'for compressing a single contiguous source file while keeping its original line order, use prune_context_skeleton instead.' This leaves no ambiguity about when to choose this tool.

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