Skip to main content
Glama
Nitesh-Nandan

query-executor

pg_stat_statements

Identify the top queries by cumulative execution time for database performance auditing. Shows normalised query text, execution statistics, and block I/O metrics.

Instructions

Return the top N most expensive queries from pg_stat_statements.

Best starting point for a performance audit — shows which query patterns cost the most cumulative time across the application.

Returns: {"rows": [{query, calls, total_exec_sec, mean_exec_sec, max_exec_sec, total_rows, shared_blks_hit, shared_blks_read}], "row_count": N}

Query text uses $1/$2 placeholders (pg_stat_statements normalises literals). Requires the pg_stat_statements extension (enabled by default on RDS, Cloud SQL, Supabase; otherwise: CREATE EXTENSION pg_stat_statements).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains that query text uses $1/$2 placeholders (normalization), notes the extension requirement with deployment-specific details, and outlines the return format. It is transparent about the read-only nature and typical usage, but does not explicitly declare non-destructiveness.

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 concise (about 4 sentences), front-loaded with the purpose, and well-structured with a clear breakdown of return format, normalization behavior, and extension requirements. A minor quibble is the inline return schema which adds some verbosity, but overall it earns its place.

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?

Given the complexity of a database performance tool and the presence of an output schema (not shown but referenced), the description covers purpose, return format, normalization, and extension prerequisites. It lacks parameter explanation but the input schema covers that. Overall it is complete enough for an agent to understand the tool's role.

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

Parameters1/5

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

The description does not explain the parameters (limit and project_id) at all. Given the schema description coverage is 0%, the description should compensate, but it fails to add any meaning beyond the schema's own parameter descriptions. The agent must infer the limit from 'top N' and is left uninformed about project_id.

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?

The description clearly states 'Return the top N most expensive queries from pg_stat_statements,' specifying a specific verb and resource. It further positions this as the 'best starting point for a performance audit,' which distinguishes it from sibling tools like execute_postgres or explain_postgres.

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

Usage Guidelines4/5

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

The description provides clear context for use ('Best starting point for a performance audit') and implies it is for identifying costly query patterns. It does not explicitly state when not to use it or name alternatives, but the context and sibling tool names make the intended usage clear.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nitesh-Nandan/query-executor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server