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

MCPg - Production-grade PostgreSQL MCP Server

Analyze rerank score distribution

analyze_rerank_score_distribution
Read-only

Analyze reranker score distributions with an equal-width histogram and top-decile share, flagging score clustering when the model fails to discriminate among results.

Instructions

Equal-width histogram of cross_encoder_score values over the window plus the top-decile share. Surfaces score_clustering (WARNING) when the reranker isn't discriminating (more than half of scores land in the top decile of the range). Reads from mcpg_rag.rerank_events. Returns an object with window_days, event_count, histogram (list of counts), bucket_edges (list of bucket boundaries), top_decile_share, and findings (list of advisory findings).

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_rerank_score_distribution"
  }
}

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.
n_bucketsNo
retrieval_indexNo

Output Schema

NameRequiredDescriptionDefault
modelYes
findingsYes
histogramYes
event_countYes
window_daysYes
bucket_edgesYes
retrieval_indexYes
top_decile_shareYes

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?

Annotations only declare readOnlyHint and openWorldHint, so the description carries the real behavioral load: it names the source table (mcpg_rag.rerank_events) and defines the exact WARNING trigger (more than half of scores in the top decile of the range). It adds meaningful interpretation semantics beyond the annotations, though it says nothing about cost, volume, or limits on the scan.

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?

Three dense sentences that are front-loaded with the core measure and then the alert semantics; nothing is padding. The final enumeration of return fields is somewhat redundant given an output schema exists, keeping it short of a 5.

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

Completeness3/5

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

For a read-only analytical tool with zero required parameters, the description covers purpose, source, and alert condition well, and the output schema handles return values. However, with four of five parameters undocumented and no guidance on choosing this analysis over its reranker-analysis siblings, an agent lacks enough to pick and configure it confidently.

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 only 20% — just the `database` parameter is documented — so the description must compensate and largely does not. 'Over the window' loosely implies `days`, and 'equal-width histogram' loosely relates to `n_buckets`, but `model` and `retrieval_index` are never explained, and no defaults or filter semantics are given.

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 precise verb and measure: 'Equal-width histogram of cross_encoder_score values over the window plus the top-decile share', and names the specific finding it produces (`score_clustering`). This is concretely distinguishable from sibling analyses such as analyze_reranker_lift and analyze_rerank_ndcg, which measure lift and ranking quality rather than score spread.

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?

Usage is only implied: the description says it surfaces `score_clustering` when the reranker isn't discriminating, which hints at a diagnostic use case. It never states when to pick this over analyze_reranker_lift, analyze_rerank_ndcg, or recommend_rerank_strategy, and offers no exclusions or prerequisites.

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