Skip to main content
Glama
devopam

MCPg - Production-grade PostgreSQL MCP Server

Analyze top-k stability

analyze_topk_stability
Read-only

Measures reranker utility by comparing top-K from bi-encoder and cross-encoder ranks; flags when Jaccard overlap is high, indicating minimal rerank impact.

Instructions

Jaccard overlap between top-K-by-bi-rank and top-K-by-cross-rank per query, aggregated. High mean Jaccard means the reranker isn't actually changing the top-K membership. Surfaces topk_stable (WARNING) when the rerank is barely earning its place at this K. Reads from mcpg_rag.rerank_events; returns a report with zero counts when the table doesn't exist or the window is empty.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kNo
daysNo
modelNo
databaseNoOptional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids.
retrieval_indexNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
kYes
modelYes
findingsYes
p25_jaccardYes
p75_jaccardYes
query_countYes
window_daysYes
mean_jaccardYes
retrieval_indexYes
Behavior5/5

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

Annotations already mark the tool as read-only and deterministic. The description adds valuable behavioral details including data source ('mcpg_rag.rerank_events') and edge-case behavior ('returns a report with zero counts when table doesn't exist or window is empty'). This fully satisfies transparency beyond annotations.

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 concise (two sentences) and front-loaded with the core purpose. It wastes no words, but the structure could be improved with clearer separation of purpose, usage, and behavior. Still, it is more efficient than typical verbose descriptions.

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?

Given the tool's moderate complexity (5 parameters, zero required) and presence of an output schema, the description fails to cover parameter semantics adequately. However, it does cover edge behavior and provides sufficient context for the core metric. Sibling tools are distinct, so identification is clear.

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?

With only 20% schema description coverage, the description adds no parameter explanations. While parameter names ('k', 'days', 'model', 'database', 'retrieval_index') are somewhat self-explanatory, the description does not clarify their semantics, defaults, or interplay. This is inadequate for a 5-parameter tool.

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?

The description clearly states the tool's purpose: calculating Jaccard overlap between top-K by bi-rank and cross-rank per query. It uses a specific verb ('analyzes') and distinct resource ('top-k stability'), and uniquely positions itself among sibling analyze tools.

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?

The description indicates when to use the tool (to detect if the reranker is not changing top-K membership, with a 'topk_stable' warning). It lacks explicit when-not-to-use guidance or comparison to alternatives like 'analyze_reranker_lift', but provides clear context.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/devopam/MCPg'

If you have feedback or need assistance with the MCP directory API, please join our Discord server