Skip to main content
Glama
call518

MCP PostgreSQL Operations

by call518

get_index_usage_stats

Analyze PostgreSQL index usage frequency and efficiency to identify unused or unnecessary indexes and review scan and tuple-return statistics for performance optimization.

Instructions

[Tool Purpose]: Analyze usage rate and performance statistics of all indexes in database

[Exact Functionality]:

  • Analyze usage frequency and efficiency of all indexes

  • Identify unused indexes

  • Provide scan count and tuple return statistics per index

[Required Use Cases]:

  • When user requests "index usage rate", "index performance", "unnecessary indexes", etc.

  • When database performance optimization is needed

  • When index cleanup or reorganization is required

[Strictly Prohibited Use Cases]:

  • Requests for index creation or deletion

  • Requests for index reorganization or REINDEX execution

  • Requests for statistics reset

Input Schema

NameRequiredDescriptionDefault
database_nameNoDatabase name to analyze (uses default database if omitted)

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.4.3
    • addedInput schema / properties / database_name / description
      Added value: +"Database name to analyze (uses default database if omitted)"
  2. Changed6 schema fields changedv3.4.2
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / database_name / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / database_name / title
      Removed value: -"Database Name"
    • removedInput schema / properties / database_name / type
      Removed value: -"string"
    • removedOutput schema / properties / result / title
      Removed value: -"Result"
    • removedOutput schema / title
      Removed value: -"_WrappedResult"
  3. Addedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses that the tool analyzes all indexes, identifies unused indexes, and returns scan count and tuple return statistics. It implicitly describes a read-only analysis operation but does not explicitly state that it is non-destructive or mention any performance impact of scanning statistics, leaving a minor gap.

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?

The description is organized with clear bracketed sections and front-loads purpose and functionality. It is appropriately sized, though the repeated 'Requests for...' phrasing in the prohibited section adds mild redundancy. Every section earns its place, and no critical information is buried.

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?

The tool has an output schema, so return values needn't be explained. The single parameter is fully documented in the schema and mentioned in context ('all indexes in database'). The description covers purpose, behavior, and usage constraints well; only explicit read-only/non-destructive confirmation is missing due to the absence of annotations.

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 100% for the single optional database_name parameter, and the schema already states it 'uses default database if omitted.' The description adds no additional parameter semantics beyond what the schema provides, so the baseline of 3 applies.

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 states a specific verb and resource: 'Analyze usage rate and performance statistics of all indexes in database.' The bulleted functionality clarifies scope (usage frequency, unused indexes, scan counts, tuple returns). It does not explicitly distinguish itself from the sibling tool get_index_io_stats, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit 'Required Use Cases' and 'Strictly Prohibited Use Cases.' It tells the agent exactly when to invoke the tool (index usage rate, performance optimization, cleanup) and when not to (creation/deletion, REINDEX, statistics reset). This is precise routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.