Skip to main content
Glama

top_queries

List top PostgreSQL queries by total_time, mean_time, calls, rows, or I/O to identify performance bottlenecks and troubleshoot slow-running statements.

Instructions

[READ] Top statements from pg_stat_statements by a whitelisted metric.

Args:
    order_by: One of total_time, mean_time, calls, rows, io.
    limit: Number of statements to return (1..200, default 20).
    target: Target name from config; omit for the default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
targetNo
order_byNototal_time
Behavior3/5

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

The [READ] prefix indicates a read-only operation, which is the primary behavioral trait. However, no annotations are provided, and the description does not disclose potential performance impact or other side effects. Basic transparency is achieved, but more detail would be beneficial.

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?

Description is concise with two opening lines and a parameter list. The list format is effective but could be integrated into prose for better readability. No wasted sentences.

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?

Parameter details are complete, but the description omits output format or return values. Given no output schema, this is a gap. The [READ] prefix partly covers behavioral context, but overall completeness is moderate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description thoroughly explains each parameter: order_by lists valid metric values, limit specifies range and default, target describes usage with config. This adds significant meaning beyond the input schema, which has 0% description coverage.

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?

Description clearly states it retrieves top statements from pg_stat_statements by a metric, with a [READ] prefix. While the verb 'Top' is slightly vague, it effectively distinguishes from sibling tools like long_running_queries and slow_query_rca.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like long_running_queries or slow_query_rca. The description does not specify prerequisites or exclusions, leaving the agent to infer context.

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/AIops-tools/Postgres-AIops'

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