Skip to main content
Glama
mirenqinggege

postgres-mcp

get_top_queries

Read-only

Retrieves slow or resource-intensive queries from pg_stat_statements. Rank by total time, mean time, or resource usage and adjust result count.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sort_byNoRanking criteria: 'total_time' for total execution time or 'mean_time' for mean execution time per call, or 'resources' for resource-intensive queriesresources
limitNoNumber of queries to return when ranking based on mean_time or total_time

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

Annotations already declare readOnlyHint=true, so the read-only nature is clear. The description adds context about using pg_stat_statements but does not disclose other behavioral traits like authentication requirements or statistical reset behavior.

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 14-word sentence that immediately conveys the tool's function with no unnecessary words. It is appropriately front-loaded and concise.

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 presence of a complete input schema and output schema, the description provides sufficient context for this simple reporting tool. It could mention that results are ranked by the chosen sort_by criterion, but the schema covers that.

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 100% with detailed descriptions for both parameters (sort_by and limit). The description adds no additional semantic meaning beyond the schema, so baseline score of 3 applies.

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's purpose: 'Reports the slowest or most resource-intensive queries' and specifies the data source ('pg_stat_statements' extension). It distinguishes from sibling tools like analyze_query_indexes which focus on indexing analysis.

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 usage for viewing slow queries but does not provide explicit guidance on when to use this tool vs alternatives (e.g., analyze_db_health) or when not to use it.

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

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