Skip to main content
Glama
devopam

MCPg - Production-grade PostgreSQL MCP Server

Analyze vector search efficiency

analyze_vector_search_efficiency
Read-only

Evaluate ANN index retrieval quality by sweeping search knobs, measuring recall@k, latency, and rank correlation against brute-force exact search. Identify baseline recall issues or ineffective pruning to tune vector search performance.

Instructions

Cross-backend retrieval-quality report for a pgvector or pg_turboquant ANN index. Detects the backend (HNSW / IVFFlat / turboquant), sweeps the matching per-backend knob (ef_search / probes / candidate_limit) across a multiplier curve, computes recall@k vs a brute-force exact baseline, Spearman + Kendall rank correlation, per-query p50/p95 wall-clock latency, and (for turboquant) the page-pruning ratio from tq_last_scan_stats. Emits findings: baseline_recall_low (CRITICAL), rerank_lift_flat / rerank_lift_steep / ranking_degraded / pruning_ineffective (WARNING). Burns sample_size x (1 + len(candidate_multipliers)) queries; ad-hoc diagnostic, not a cron tool. Requires the vector extension; turboquant-arm metrics require pg_turboquant.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kNo
tableYes
columnYes
metricNocosine
schemaYes
databaseNoOptional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids.
id_columnYes
index_nameNo
sample_sizeNo
candidate_multipliersNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
kYes
tableYes
columnYes
metricYes
schemaYes
backendYes
findingsYes
index_nameYes
sample_sizeYes
rerank_lift_curveYes
recall_at_k_baselineYes
pages_pruned_ratio_p50Yes
score_rank_correlation_kendallYes
score_rank_correlation_spearmanYes
Behavior4/5

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

The description discloses significant behavioral traits beyond the annotations: it burns queries (resource use), emits specific findings with severity levels (baseline_recall_low, rerank_lift_flat, etc.), and requires extensions. The readOnlyHint=true annotation is consistent with 'report', and the description adds that it runs queries (read-only but costly) and provides diagnostic output.

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 four sentences long and packs dense technical information. It is front-loaded with the main purpose. While a bit verbose with acronyms and technical details, every sentence adds value. Could be slightly tighter, but overall efficient.

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?

Given the tool's complexity (10 parameters, output schema exists, multiple backends), the description is remarkably complete. It covers what the tool does, how it works (sweep knobs, exact baseline comparison, per-query latency, page-pruning ratio), what findings it emits, its resource cost, and prerequisites. The output schema (not shown) likely documents return values, so the description rightly focuses on behavior.

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 only 10% (only database has a description). The description adds context for sample_size and candidate_multipliers (mentions sweeps across a multiplier curve) and implies how k and metric are used. However, it does not explain parameters like schema, table, column, id_column, or index_name in detail. It partially compensates by explaining the overall algorithm, but many parameters remain underspecified.

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 explicitly states it produces a 'cross-backend retrieval-quality report' for ANN indexes, naming specific backends (HNSW, IVFFlat, turboquant) and listing the exact metrics computed (recall@k, latency, rank correlation). This clearly distinguishes it from sibling tools like analyze_hnsw_recall, vector_recall_at_k, and tune_vector_index, which have narrower scopes.

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 provides clear usage guidance: it is an 'ad-hoc diagnostic, not a cron tool' and warns about the query burden ('Burns sample_size x (1 + len(candidate_multipliers)) queries'). It also states prerequisites (vector extension, pg_turboquant for turboquant metrics). However, it does not explicitly contrast with similar tools like analyze_hnsw_recall or recommend when to use this over them.

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