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

MCPg - Production-grade PostgreSQL MCP Server

Recommend IVFFlat probes

recommend_ivfflat_probes
Read-only

Recommends an IVFFlat probes value to meet a target recall@k by sampling queries, measuring exact top-k ground truth, and sweeping probe settings for recall and latency.

Instructions

Recommend an ivfflat.probes value for a target recall@k — the IVFFlat analogue of recommend_hnsw_ef_search. Samples sample_queries rows (default 10) as query vectors, builds an exact brute-force top-k ground truth per query, sweeps probe_values (default 1/2/5/10/20/50) measuring mean recall@k and p50/p95 latency at each, and recommends the smallest value clearing target_recall (default 0.95). VERIFIES an IVFFlat index actually exists on the column (returns has_ivfflat_index=false with guidance otherwise — a sweep without one just measures sequential scans). The query row is excluded from its own results. Requires the vector extension. Returns an object with available, has_ivfflat_index, index_name, metric, k, target_recall, sample_queries, recommended_probes (int or null), detail, and sweep (list of objects with probes, mean_recall_at_k, p50_latency_ms, p95_latency_ms, meets_target).

Example: recommend_ivfflat_probes(schema='public', table='docs', column='embedding', k=10, target_recall=0.95)

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>"
    },
    "name": "recommend_ivfflat_probes"
  }
}

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.
target_recallNo
sample_queriesNo

Output Schema

NameRequiredDescriptionDefault
kYes
sweepYes
detailNo
metricYes
availableYes
index_nameYes
target_recallYes
sample_queriesYes
has_ivfflat_indexYes
recommended_probesYes

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

A4.3/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint=false; the description goes well beyond by disclosing the entire measurement procedure (sampling rows, building exact brute-force ground truth, sweeping probe values, measuring mean recall@k and p50/p95 latency), a default sweep set, the default target recall, the smallest-value-that-clears-target selection rule, and the self-match exclusion caveat. These are behavioral traits an agent could not infer from annotations or schema, and they materially affect how results should be interpreted.

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?

Front-loaded with the core purpose and method, then verification, then caveats; the example call at the end aids invocation. The final enumeration of ten return fields is redundant given an output schema exists and is the one block that does not earn its space, keeping it from a 5.

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?

For an 8-parameter analysis tool with an output schema and only read-only annotations, the description covers mechanics, preconditions, defaults, and selection policy thoroughly. The dangling `probe_values` reference and the thin `metric` treatment are the notable holes; return values need not be explained since an output schema is present.

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% (essentially just `database`), so the description must compensate; it does supply defaults and meaning for `k`, `target_recall`, and `sample_queries`. However, it references a `probe_values` parameter with a default list that does not exist in the input schema, which could mislead an agent into passing an invalid argument, and it leaves `metric` semantics largely unexplained beyond appearing in the return object.

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?

Names a specific action (recommend an `ivfflat.probes` value), the exact resource (IVFFlat index probes for a target recall@k), and explicitly differentiates itself from the sibling `recommend_hnsw_ef_search` by calling itself 'the IVFFlat analogue'. An agent can distinguish it from `tune_vector_index`, `vector_recall_at_k`, and `analyze_hnsw_recall` without opening any schema.

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?

Gives clear preconditions and context: an IVFFlat index must exist (it verifies and returns `has_ivfflat_index=false` otherwise, explaining why a sweep without one is meaningless), and the vector extension is required. It routes to the HNSW counterpart by analogy, but does not explicitly state when-not to use it (e.g., versus `tune_vector_index` or `analyze_vector_search_efficiency`), so it falls short of full alternative routing.

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