Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

Analyze reranker lift

analyze_reranker_lift
Read-only

Measures per-query Spearman and Kendall rank correlation between bi-encoder and cross-encoder results to show whether a reranker actively reorders or mostly confirms order.

Instructions

Per-query Spearman + Kendall correlation between bi-encoder and cross-encoder ranks, aggregated across queries in the window. Low correlation = the reranker is actively reordering (doing real work); high correlation = the reranker mostly confirms the bi-encoder order. Optional model / retrieval_index filters. Surfaces reranker_idle (WARNING) when the reranker rarely changes ordering. Reads from mcpg_rag.rerank_events; returns a report with zero counts when the table doesn't exist or the window is empty.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "analyze_reranker_lift"
  }
}

Input Schema

NameRequiredDescriptionDefault
daysNo
modelNo
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.
retrieval_indexNo

Output Schema

NameRequiredDescriptionDefault
modelYes
findingsYes
query_countYes
window_daysYes
mean_kendallYes
p25_spearmanYes
p75_spearmanYes
mean_spearmanYes
interpretationYes
retrieval_indexYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. First observedv0.6.8

TDQS

A3.7/5.0
Behavior4/5

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

Beyond the readOnlyHint/openWorldHint annotations, it discloses the underlying source table (mcpg_rag.rerank_events), the degradation behavior when the table is missing or the window is empty (zero-count report rather than an error), and that it can emit a reranker_idle WARNING. That is genuine behavioral context an annotation cannot convey; the only gap is the absence of a threshold definition for 'rarely changes ordering'.

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?

Four dense sentences with the metric definition front-loaded, followed by interpretation, optional filters, warning behavior, and edge cases — a sensible priority order with no filler. Parenthetical clarifications earn their space; only slight tightening would be possible.

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?

An output schema exists, so return-value explanation is rightly omitted, and the description still covers data source, aggregation scope, filters, warning emission, and empty/missing-table behavior — a lot for a 4-parameter read-only tool. The remaining shortfall is quantitative: no guidance on what counts as 'low' vs 'high' correlation or what minimal volume of rerank events is needed for a meaningful signal.

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 only 25% (just `database`), so the description must carry weight: it flags `model` and `retrieval_index` as optional filters and the 'window' wording maps loosely to `days`. However, it gives no format or default for `days`, no example values for `model`/`retrieval_index`, and does not say whether the filters apply to queries, documents, or both — partial compensation only.

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 names a specific computation (per-query Spearman + Kendall correlation between bi-encoder and cross-encoder ranks, aggregated over a window), which is far more precise than the title alone. It implicitly separates itself from neighbors like analyze_rerank_ndcg or analyze_rerank_score_distribution by stating exactly which statistic it produces, though it never names an alternative explicitly.

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

Usage Guidelines3/5

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

It explains how to interpret results (low correlation = reranker actively reordering, high = confirming), which implies the diagnostic use case, but there is no explicit 'use this when…' statement, no exclusions, and no pointer to the sibling rerank tools (ndcg, score distribution, recommend_rerank_strategy). An agent knows what the number means but not when to prefer this over the other rerank analyses.

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

Deploy Server

Other Tools