Skip to main content
Glama
pg-perf-mcp

pg-perf-mcp

by dixitgurv

slow_queries

Identify high-impact PostgreSQL queries from pg_stat_statements by total time, mean time, call count, or disk reads to target performance tuning.

Instructions

Top queries from pg_stat_statements: total time, mean time, call count or disk reads.

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": "slow_queries"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
order_byNototal

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations, the description carries the full burden and discloses only the data source and the four metrics. It omits that pg_stat_statements must be installed/enabled, that figures are cumulative since the last stats reset, and any cost or latency characteristics of scanning the view.

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?

A single dense clause with the source front-loaded and zero filler. It is a noun fragment rather than a sentence, but every word carries information.

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 two-parameter, default-only read tool with an output schema, the description covers the metric dimension adequately. The main missing piece is the pg_stat_statements extension prerequisite, which matters for whether a call can succeed at all.

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 coverage is 0%, so the description must compensate. It does map the order_by enum values to meanings (total→total time, mean→mean time, calls→call count, io→disk reads), which is genuinely useful, but the limit parameter and its default of 10 are never explained.

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?

States a specific resource ('Top queries from pg_stat_statements') and enumerates the ranking metrics, which distinguishes it from siblings like active_queries by naming the cumulative-stats source. No explicit verb, but the retrieval intent is unambiguous.

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 is only implied: naming pg_stat_statements signals historical/aggregated query stats rather than live activity, which indirectly routes the agent away from active_queries. There is no explicit when-to-use, when-not, or named alternative.

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