Skip to main content
Glama
Eszetael

postgres-mcp-hardened

Slowest statements server-wide

top_queries
Read-onlyIdempotent

Identify the most expensive SQL queries by total execution time across the server. Uses pg_stat_statements; if missing, provides enablement instructions and directs to explain_query for detailed plans.

Instructions

WHICH statements cost the most, ranked by total execution time across the whole server. Requires the pg_stat_statements extension; if it is missing the answer says how to enable it. Take the statement you find here to explain_query for the plan.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
databaseNowhich configured database to use; omit when only one is configured
Behavior4/5

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

Annotations already declare readOnly, idempotent, and non-destructive behavior. The description adds a key behavioral trait: it requires the pg_stat_statements extension and will return instructions to enable it if absent. It also implies the output contains statement text suitable for explain_query. This adds meaningful transparency beyond the annotations.

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?

The description is three sentences, tightly packed with purpose, prerequisites, and a cross-reference to explain_query. It front-loads the primary action and avoids unnecessary elaboration. Every sentence 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 simplicity of the tool (2 params, no output schema), the description covers the essential aspects: what it does, the extension dependency, and a pointer to the next step. It doesn't mention ordering direction (descending) or output limit behavior, but these are reasonably inferred. It is nearly complete for a read-only listing tool.

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?

The schema provides descriptions for only one of two parameters (database) and the limit parameter has constraints but no description. The tool description does not mention parameters at all. With 50% schema coverage, the description should compensate, but it doesn't. The limit parameter is self-explanatory from its name and constraints, so a mid-score is appropriate.

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 the tool identifies the statements costing the most, ranked by total execution time server-wide. It distinguishes from siblings by specifying the resource (statements) and the metric (total execution time), and it contrasts with explain_query which is for plans.

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 usage context: use to find top expensive statements, and then take the result to explain_query for the plan. It also notes the extension requirement and that the tool will explain how to enable it if missing. However, it doesn't explicitly state when not to use this tool versus other query tools, so it gets a 4 rather than 5.

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/Eszetael/postgres-mcp-hardened'

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