Skip to main content
Glama

get_slow_queries

Improve PostgreSQL query performance by retrieving the top slowest queries from pg_stat_statements. Analyze execution time to pinpoint optimization opportunities.

Instructions

Retrieve top slowest queries recorded by pg_stat_statements extension (if enabled in PostgreSQL)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of slow queries to return (default: 15)
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the dependency on the 'pg_stat_statements' extension being enabled, which is a critical behavioral trait. However, it does not mention whether the tool is read-only, if it requires special permissions, or how it handles missing extensions (e.g., error vs. empty result).

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 a single, well-structured sentence that conveys the core purpose and a key dependency. No extraneous text; every word adds value. Could be slightly more concise by removing 'recorded by' but overall efficient.

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?

Given the simple parameter (single optional integer) and no output schema, the description is mostly adequate but misses context about return format (e.g., list of queries, metrics like execution time, I/O). Sibling tools suggest a performance-oriented context, but the description doesn't clarify what 'slowest' means (e.g., by total time, mean time, or max time).

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?

With schema description coverage at 100%, the schema already documents the 'limit' parameter with a default and description. The tool description adds no additional semantics beyond what the schema provides, meeting the baseline 3. The description does not explain how the limit affects results (e.g., ties, ordering).

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 clearly states it retrieves top slowest queries, with a specific verb ('Retrieve') and resource ('pg_stat_statements extension'). It distinguishes itself from siblings like 'read_query' or 'explain_query' by targeting performance monitoring rather than general query execution or 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 database performance tuning (slow queries) but does not explicitly state when to use this tool versus alternatives like 'explain_query' for individual query analysis or 'get_table_stats' for schema-level performance. No exclusions or prerequisites are mentioned beyond the extension dependency.

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/mewsyy/pg-context'

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