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

MCPg - Production-grade PostgreSQL MCP Server

Recommend indexes

recommend_indexes
Read-only

Identifies large PostgreSQL tables read mostly by sequential scans and recommends indexing candidates, with an option to bypass cache and re-read live after schema changes.

Instructions

Recommend tables that may benefit from indexing — large tables read mostly by sequential scan. Set fresh=true to bypass the cache and re-read live (e.g. after a schema change). Returns a list of objects with schema, table, live_tuples, sequential_scans, index_scans, and a reason explaining why the table is a candidate.

Example: recommend_indexes(min_live_tuples=10000)

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "recommend_indexes"
  }
}

Input Schema

NameRequiredDescriptionDefault
freshNo
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.
min_live_tuplesNo

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. Changed1 schema field changed
    • addedInput schema / properties / fresh
      Added value: +{
      +  "default": false,
      +  "title": "Fresh",
      +  "type": "boolean"
      +}
  3. First observedv0.6.8

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description still adds real behavioral value by disclosing that results are cached by default and that `fresh=true` forces a live re-read — information found nowhere else in the structured data.

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?

Four short, front-loaded segments — purpose with criteria, a parameter tip, the return shape, and a call example — with no filler. Every sentence carries a distinct piece of information an agent would otherwise have to infer.

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 a three-parameter read-only tool with no required arguments and an output schema present, this covers the essentials: what qualifies a table, cache behavior, and a usage example. Remaining gaps — what `min_live_tuples` means precisely and whether the recommendation accounts for existing indexes — are minor but non-trivial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 33%: only `database` has a schema description, so `fresh` and `min_live_tuples` rely on the description. The description explains `fresh` concretely (bypass cache, re-read live) and anchors `min_live_tuples` through a worked example, though it never defines the threshold semantics or the default of 10000 in prose.

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 ('Recommend tables that may benefit from indexing') and defines the qualifying signal — large tables read mostly by sequential scan — so an agent knows exactly what comes back. It does not name the closest sibling, recommend_index_drops, or clarify that this is the additive counterpart to that drop-oriented tool.

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 context is implied through the candidate criteria (sequential-scan-heavy large tables) and the explicit case for `fresh=true` after a schema change. What is missing is routing guidance: nothing says when to pick this over recommend_index_drops, run_advisors, or optimize_query, which all overlap in the tuning workflow.

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