Skip to main content
Glama

Inspect Hybrid Retrieval & RRF

inspect_retrieval

Diagnose RAG retrieval misses and low rankings by comparing vector and keyword/FTS scores and inspecting RRF fusion, tenant pre-filtering, and timings.

Instructions

只读排查 PostgreSQL/PgVector 企业级 RAG 检索链路:对比单路向量检索分数与关键词/FTS 分数、展示 RRF 融合排名及多租户 Pre-filtering 结果和耗时,定位漏召回或排序偏低问题。

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": {
      "query": "<query>"
    },
    "name": "inspect_retrieval"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes待排查的用户检索问题原文或关键词
rrf_kNoRRF 平滑常数 k,默认 20
top_kNo返回 RRF 融合后的候选分块数量,上限 20
tenant_idNo多租户 Pre-filtering 租户标识,默认 defaultdefault
doc_statusNo文档版本状态过滤,默认 activeactive
collection_nameNo可选:限定知识库集合名称(如 kblegal / kbgroupfinance)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does disclose key behavior: read-only ('只读'), and that the response contains both single-path vector and keyword/FTS scores, RRF fusion rankings, multi-tenant pre-filtering output, and elapsed time. It omits cost/latency expectations for a heavy diagnostic query and any limits on result volume.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single dense sentence that front-loads the read-only nature and then enumerates exactly what is compared and displayed. Despite being information-rich, every clause carries distinct content with no redundancy.

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

Completeness5/5

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

For a 6-parameter diagnostic tool with no annotations and no output schema, the description compensates by describing what the response contains (parallel vector vs FTS scores, RRF ranking, pre-filtering results, timing). Combined with 100% schema coverage, an agent has what it needs to invoke it correctly.

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 100%, so every parameter already has its meaning and defaults documented, which sets the baseline at 3. The description adds conceptual context for RRF fusion and multi-tenant pre-filtering (mapping loosely to rrf_k and tenant_id), but says nothing about doc_status or collection_name, so it does not meaningfully exceed the schema.

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?

The description gives a specific verb set (compare vector scores with FTS scores, display RRF fusion ranking and pre-filtering results and timing) against a concrete resource (PostgreSQL/PgVector RAG retrieval chain), and states it is read-only. It does not name or contrast the sibling tools explain_vector_query or view_chunk_context, so it falls short of the full sibling-differentiation bar for 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 Guidelines4/5

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

It clearly states the diagnostic context in which to use it: locating missed recalls or low-ranking results ('定位漏召回或排序偏低问题'). There is no explicit when-not guidance and no routing to the sibling alternatives, so it is clear context without exclusions.

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