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

MCPg - Production-grade PostgreSQL MCP Server

Tune vector index

tune_vector_index
Read-only

Recommend an ivfflat or hnsw configuration for a pgvector column by reading live row count and dimension, applying standard heuristics, and returning parameters with a ready-to-run CREATE INDEX statement.

Instructions

Recommend an ivfflat or hnsw configuration for a pgvector column. Reads the live row count and column dimension, applies the standard pgvector heuristics, and returns the parameters plus a ready-to-run CREATE INDEX statement. 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>"
    },
    "name": "tune_vector_index"
  }
}

Input Schema

NameRequiredDescriptionDefault
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.
index_typeNohnsw

Output Schema

NameRequiredDescriptionDefault
dimensionYes
rationaleYes
row_countYes
index_typeYes
parametersYes
create_index_sqlYes

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.9/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 the safe-read profile is covered; the description adds genuine context by saying it reads live row count and column dimension and returns a ready-to-run CREATE INDEX statement, making clear it advises rather than builds the index. It stops short of noting cost or runtime of the recommended build, which is the one behavior an agent might still need.

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?

Three tight sentences: what it does, how it behaves, and the prerequisite. Nothing is repeated from the title and no sentence is filler.

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 return values need no explanation, and the extension prerequisite is stated. However, for a 6-parameter tool at low schema coverage, the undefined metric and index_type tradeoffs leave real gaps an agent would want before calling it.

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 17%, so the description must compensate: it covers schema/table/column implicitly and index_type via 'ivfflat or hnsw', but the metric parameter (default l2) and its allowed values are never mentioned, even though metric directly changes the emitted CREATE INDEX statement. The added meaning is partial rather than complete.

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?

States a specific verb and resource ('Recommend an ivfflat or hnsw configuration for a pgvector column') and implicitly separates itself from query-time tuning siblings such as recommend_hnsw_ef_search and recommend_ivfflat_probes by targeting index-build configuration instead.

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?

The prerequisite ('Requires the vector extension') is explicit and useful, but there is no statement of when to prefer this over recommend_indexes or the recall-analysis tools, nor any exclusion guidance. Usage is implied by the resource description rather than spelled out.

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