Skip to main content
Glama
Snarloff

pg-multi-mcp

by Snarloff

get_top_queries

Read-only

Identifies slow or resource-intensive PostgreSQL queries from pg_stat_statements data to help prioritize performance tuning.

Instructions

Reports the slowest or most resource-intensive queries using data from the 'pg_stat_statements' extension.

Input Schema

NameRequiredDescriptionDefault
limitNoNumber of queries to return when ranking based on mean_time or total_time
sort_byNoRanking criteria: 'total_time' for total execution time or 'mean_time' for mean execution time per call, or 'resources' for resource-intensive queriesresources
connectionNoNome ou alias da conexão (veja list_connections). Se omitido, usa a conexão ativa ou a padrão.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

readOnlyHint=true already tells the agent this is a safe read, so the description only needs to add context. It does contribute one meaningful fact: results depend on the 'pg_stat_statements' extension being available, which signals a possible failure/empty-result mode. It says nothing about pagination, result shape, or what happens when the extension is missing.

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 tight sentence with no filler, and the core purpose is front-loaded. It is appropriately sized, though it is terse enough that it leaves the gaps noted in other dimensions unfilled.

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?

With an output schema present and annotations declaring read-only safety, the description needn't explain return values, and all three parameters are covered by the schema. Adding the extension dependency is genuinely useful; only minor items (behavior with a missing extension, relationship to explain_query) are absent.

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%, so every parameter (limit, sort_by, connection) is already documented in the schema. The description's phrase 'slowest or most resource-intensive' loosely mirrors the sort_by options but adds no syntax or behavioral detail beyond the schema, so baseline 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?

States a specific verb ('Reports') and resource ('slowest or most resource-intensive queries') plus the data source ('pg_stat_statements'). This implicitly differentiates it from siblings like explain_query (single-query analysis) and analyze_workload_indexes (index advice), though it never names them explicitly.

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: an agent can infer this is a performance-triage tool for finding costly queries. There is no explicit when-to-use, when-not-to-use, or routing to alternatives such as explain_query for drilling into a specific statement.

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