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

MCPg - Production-grade PostgreSQL MCP Server

TurboQuant rerank candidates

turboquant_rerank_candidates
Read-only

Retrieve approximate candidates from a turboquant index, then rerank them with SQL-side exact distance calculations to return final results with approximate and exact ranks.

Instructions

Run tq_rerank_candidates against a turboquant index — approximate retrieval followed by SQL-side exact rerank to final_limit results. Returns the candidates with both approximate and exact ranks / distances. half_precision=True switches to the halfvec overload. Requires the pg_turboquant 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>",
      "id_column": "<id_column>",
      "embedding_column": "<embedding_column>",
      "query_vector": "<query_vector>",
      "metric": "<metric>",
      "candidate_limit": "<candidate_limit>",
      "final_limit": "<final_limit>"
    },
    "name": "turboquant_rerank_candidates"
  }
}

Input Schema

NameRequiredDescriptionDefault
tableYes
metricYes
probesNo
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
final_limitYes
query_vectorYes
half_precisionNo
candidate_limitYes
embedding_columnYes
oversample_factorNo

Output Schema

NameRequiredDescriptionDefault
resultYes

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

B3.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered; the description then adds genuinely new behavioral context: the two-phase execution model, the pg_turboquant extension dependency, and the halfvec overload triggered by half_precision. It does not mention cost, latency, or what happens when candidate_limit < final_limit, but the additions go meaningfully beyond the structured fields.

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 compact sentences, front-loaded with the operation and pipeline, then returns, then the precision switch and prerequisite. No filler, though the backtick-heavy notation (``final_limit``) and the trailing dependency sentence are slightly awkward in ordering.

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 brief return-value note suffices, and the extension prerequisite is a valuable addition. But for a 12-parameter, 8-required tool with near-zero schema coverage, the description leaves most parameters — including the query_vector format and the metric/probes knobs — undocumented, which is a real gap for correct invocation.

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?

Schema description coverage is 8% — only `database` is documented in the schema — so the description carries the burden for 12 parameters. It clarifies final_limit (exact rerank target), half_precision, and ties candidate_limit to the approximate stage only via the phrase 'approximate retrieval', but leaves metric, probes, oversample_factor, id_column, embedding_column, query_vector (array vs string form), schema, and table entirely unexplained.

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 operation and resource: run tq_rerank_candidates against a turboquant index, with the two-stage pipeline (approximate retrieval then SQL-side exact rerank to final_limit) spelled out. That mechanism implicitly separates it from turboquant_approx_candidates and from generic vector_search, though no sibling is named explicitly.

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?

It gives a prerequisite (requires the pg_turboquant extension) and a mode switch (half_precision=True uses the halfvec overload), which helps an agent decide it can call the tool at all. However, there is no explicit guidance on when to choose this over turboquant_approx_candidates, vector_search, or the analyze_reranker_* tools, so the selection logic is left to inference.

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