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

MCPg - Production-grade PostgreSQL MCP Server

Vector recall at k

vector_recall_at_k
Read-only

Measure recall@k for an existing pgvector index against brute-force ground truth, returning mean overlap over sampled table rows to assess index search quality.

Instructions

Measure recall@k of an existing pgvector index against a brute-force ground truth (function-form distance, which pgvector documents as non-indexed). Returns the mean overlap over a sample of rows from the table. Requires the vector extension.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "schema": "<schema>",
      "table": "<table>",
      "column": "<column>",
      "id_column": "<id_column>"
    },
    "name": "vector_recall_at_k"
  }
}

Input Schema

NameRequiredDescriptionDefault
kNo
tableYes
columnYes
metricNol2
schemaYes
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.
id_columnYes
sample_sizeNo

Output Schema

NameRequiredDescriptionDefault
kYes
metricYes
mean_recallYes
sample_sizeYes

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.6/5.0
Behavior4/5

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

Annotations already establish readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description still adds real value beyond that: it discloses the return semantics ('mean overlap over a sample of rows'), the ground-truth methodology, and the vector-extension prerequisite. It does not warn that the brute-force comparison is potentially expensive on large tables, which is the main operational risk.

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 sentences, front-loaded with the core action and free of filler; the parenthetical about function-form distance is well placed as an inline caveat. Slightly dense, but every clause carries information.

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?

An output schema exists, so the return values need not be explained, and the description is adequate on methodology. For an 8-parameter tool with 13% schema coverage and a near-duplicate sibling, though, it leaves an agent guessing about metric options, id_column's role, and how to choose between this and analyze_hnsw_recall.

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 13% — just the 'database' parameter is documented, so seven others (k, table, column, metric, schema, id_column, sample_size) carry titles only. The description partially compensates by mentioning 'k' in recall@k and 'a sample of rows' (mapping loosely to sample_size), but gives no meaning for metric, id_column, or column. It is not the baseline-3 case where the schema does the heavy lifting, yet it does not fall to 1 because it clarifies the two most conceptually load-bearing parameters.

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 verb and resource ('Measure recall@k of an existing pgvector index') and immediately pins down the comparison baseline ('brute-force ground truth') plus a caveat about function-form distance being non-indexed. That is far more specific than a tautology. It stops short of a 5 because the sibling tool analyze_hnsw_recall targets the same measurement question and is never acknowledged or distinguished.

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 implied rather than stated: it measures an *existing* index, which suggests when it applies. The only explicit precondition is 'Requires the vector extension.' There is no guidance on when to prefer this over analyze_hnsw_recall, tune_vector_index, or recommend_ivfflat_probes, all of which sit in the same vector-tuning cluster.

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