Skip to main content
Glama

slow_query_rca

Pinpoint the slowest PostgreSQL query and get cited causes plus concrete actions from pg_stat_statements metrics and optional EXPLAIN plans.

Instructions

[READ] RCA for the worst pg_stat_statements entry, with cause + action.

Picks the statement with the greatest total execution time and maps its
numbers (mean time, cache-hit ratio, temp spill, calls) — plus an optional
EXPLAIN plan — to cited causes and concrete actions. Pass 'statements' for
pure/offline analysis, or omit to pull the top statements live.

Args:
    statements: Injected pg_stat_statements rows (as from top_queries); if
        omitted, the worst statements are pulled live.
    explain_sql: Optional SQL to EXPLAIN so plan node types feed the RCA.
    limit: How many statements to pull when not injected (default 20).
    target: Target name from config; omit for the default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
targetNo
statementsNo
explain_sqlNo
Behavior4/5

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

No annotations provided, so description carries full burden. Declares read-only via '[READ]', explains it picks the statement with greatest total time, maps metrics to causes/actions, and notes optional offline mode. Does not disclose side effects or permissions, but for a read tool this is sufficient.

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?

Concise yet comprehensive: one sentence for purpose/behavior, clear bullet-style parameter descriptions. No wasted words; every sentence adds value.

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?

Lacks output schema and does not describe return format (e.g., structure of causes and actions). Agent knows the tool returns causes and actions but cannot predict structure. For an RCA tool, this is a notable gap given no output schema.

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?

Input schema has 0% description coverage, but the description's Args section explains each param: statements (injected rows or live), explain_sql (optional SQL), limit (default 20), target (target name). Adds substantial meaning beyond type/defaults.

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?

Starts with '[READ] RCA for the worst pg_stat_statements entry, with cause + action.' Clearly identifies the tool as a root cause analysis on the worst query, specifying it reads and provides actionable insights. Distinguishes it from siblings like top_queries (lists queries) and explain_query (just explains).

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

Usage Guidelines4/5

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

Describes when to use for analyzing the worst query with causes and actions. Explains optional parameters for offline vs live analysis. However, no explicit when-not-to-use or comparison to sibling tools beyond implied 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