Skip to main content
Glama
devopam

MCPg - Production-grade PostgreSQL MCP Server

Recommend efficiency thresholds

recommend_efficiency_thresholds
Read-only

Compute corpus-percentile thresholds for recall, ranking, and pruning efficiency from accumulated history, with optional filtering by backend, metric, or k to adapt thresholds to your deployment's normal behavior.

Instructions

Compute corpus-percentile thresholds from accumulated mcpg_rag.efficiency_observations history. Phase E currently adapts three thresholds: baseline_recall_low (p10 of recall_baseline), ranking_degraded_spearman (p10 of spearman), and pruning_ineffective (p10 of pages_pruned_ratio_p50). The remaining four thresholds stay at their hardcoded defaults. Filters by days window + optional backend / metric / k so callers can ask 'what's normal for HNSW+cosine+k=10 in this deployment' vs 'what's normal globally'. Falls back to defaults (with derived_from_corpus=false) when the corpus is smaller than the minimum required. Returns an object with corpus_size, derived_from_corpus (bool), and the threshold fields (baseline_recall_low, baseline_recall_low_adapted, ranking_degraded_spearman, ranking_degraded_spearman_adapted, pruning_ineffective, pruning_ineffective_adapted, rerank_lift_flat_delta, rerank_lift_steep_low, rerank_lift_steep_high, and ranking_degraded_recall).

Input Schema

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
corpus_sizeYes
baseline_recall_lowYes
derived_from_corpusYes
pruning_ineffectiveYes
rerank_lift_steep_lowYes
rerank_lift_flat_deltaYes
rerank_lift_steep_highYes
ranking_degraded_recallYes
ranking_degraded_spearmanYes
baseline_recall_low_adaptedYes
pruning_ineffective_adaptedYes
ranking_degraded_spearman_adaptedYes
Behavior4/5

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

Annotations indicate readOnlyHint=true and openWorldHint=false. The description adds transparency by listing which thresholds are adapted, the fallback behavior with derived_from_corpus bool, and the fact that four thresholds stay at hardcoded defaults. No contradiction with annotations.

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?

The description is well-structured, front-loading the core purpose, then detailing thresholds, filtering, fallback, and return fields. Every sentence provides necessary information without redundancy.

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?

Given the tool's complexity and the existence of an output schema, the description covers the essential aspects: what it does, how to filter, fallback, and return structure. It could clarify the meaning of 'adapted' vs non-adapted thresholds, but is generally complete.

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 low (20%), but the description compensates by explaining the purpose of days, backend, metric, and k for filtering corpus history. It does not detail default values or allowed ranges, leaving some ambiguity.

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 computes corpus-percentile thresholds from efficiency observations history. It names specific thresholds and distinguishes itself from other recommend_* tools by focussing on efficiency thresholds adaptation.

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 explains how to filter by days, backend, metric, and k, with concrete examples like 'what's normal for HNSW+cosine+k=10'. It also describes fallback behavior when corpus is small. However, it does not explicitly state when not to use this tool or mention alternatives.

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