Skip to main content
Glama
stand-out-of-my-sun

Diogenes Context Compression, Code Patching & Deterministic Solver MCP

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

rerank_hybrid_rag_chunks
Read-onlyIdempotent

Rerank and deduplicate candidate RAG or search chunks against a query. Select top-K non-redundant passages using BM25, RRF, and MMR diversity filtering.

Instructions

Reranks and deduplicates candidate RAG or search chunks against a query 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 'query' ('documents_json' defaults to 'standard'), uses '?demo=true' or L402 (50 sats); HTTP 400 if invalid.

Input Schema

NameRequiredDescriptionDefault
queryYesTechnical search query or question used to score candidate chunks.
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.
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. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare read-only/idempotent/non-destructive, but the description adds real extra context: 32 KB payload cap, 60 RPM rate limit, auth path (demo=true or L402 at 50 sats), and HTTP 400 on invalid input. These operational constraints are not encoded anywhere else.

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 algorithm and pipeline purpose, then usage routing, then operational constraints — good ordering. It is dense and jargon-heavy (k1, b, RRF, MMR, L402), but nearly every clause carries actionable information.

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 and rich annotations present, the description needn't explain return values, and it covers scope, routing, rate limits, and auth. The only gap is the inaccurate 'documents_json defaults to standard' note, which contradicts the required-parameter declaration and could confuse an agent.

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 all four parameters, including the ranking_mode enum and top_k default. The description adds little beyond algorithm context, and its stray claim that 'documents_json defaults to standard' conflicts with the schema marking it required, which could mislead.

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+resource ('reranks and deduplicates candidate RAG or search chunks') and names the exact algorithmic pipeline (BM25, RRF, MMR). It explicitly differentiates from the sibling prune_context_skeleton, so an agent can select it 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?

Provides an explicit when-to-use ('selecting top-K highest-signal, non-redundant passages from vector search or grep results') and a when-to-use-otherwise routing to prune_context_skeleton for the contiguous-file case. Nothing is left to inference.

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