Skip to main content
Glama
gokiwitech

pgwarden-mcp

by gokiwitech

get_top_queries

Read-only

Identify slowest or most resource-intensive queries from pg_stat_statements to pinpoint performance bottlenecks by total time, mean time, or resource usage.

Instructions

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

Input Schema

TableJSON 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
databaseNoOptional. Alias of the configured database to query. Omit it when the server has only one database configured. When several are configured this parameter is required - call list_databases first to learn the valid aliases.

Output Schema

TableJSON 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?

The description uses 'reports', which aligns with the readOnlyHint annotation and confirms the read-only behavior. It adds a useful behavioral detail that data comes from the pg_stat_statements extension, implying a prerequisite. However, it does not describe what happens if the extension is unavailable or any other operational characteristics beyond what annotations already cover.

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 a single, focused sentence with no redundant or extraneous information. It front-loads the core purpose and names the data source efficiently, achieving high conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has a complete input schema and an output schema, so return values are covered. The description states the purpose and data source but omits prerequisites (e.g., the pg_stat_statements extension being enabled) and does not provide guidance on choosing this over sibling analysis tools. For a simple read-only tool, this is adequate but not rich.

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 input schema provides 100% coverage with detailed descriptions for all three parameters (limit, sort_by, database). The tool description adds no parameter-specific meaning beyond what the schema already states, so the baseline of 3 is appropriate.

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 ('reports') and resource ('slowest or most resource-intensive queries'), and names the data source (pg_stat_statements), which clearly conveys the tool's function. It does not explicitly differentiate from sibling tools like explain_query or analyze_workload_indexes, but the purpose is distinct enough to be understood without opening the schema.

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?

The description implies the tool is used to retrieve top queries by performance, giving a clear use case. However, it provides no explicit guidance on when to use this tool versus alternatives, no exclusions, and does not reference any sibling tools, leaving routing decisions to the agent's inference.

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