Skip to main content
Glama

slow_query_rca

Identifies root causes for the slowest SQL statement digest and proposes concrete actions, analyzing lock time, no-index scans, temp-disk usage, and optional EXPLAIN plans.

Instructions

[READ] RCA for the worst statement digest, with cause + action.

Picks the digest with the greatest total time and maps its numbers (no-index share, lock-time share, examined/sent ratio, tmp-disk 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 digests live from performance_schema.

Args: statements: Injected digest rows (as from top_queries); if omitted, the worst statements are pulled live. explain_sql: Optional SQL to EXPLAIN so plan access 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?

With no annotations provided, the description carries the full behavioral burden. It starts with '[READ]' indicating a read-only operation, and explains the live vs offline data source behavior ('pulled live from performance_schema'). It also discloses the selection algorithm (picks greatest total time) and how EXPLAIN feeds the RCA, providing substantial behavioral insight.

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 front-loaded with a concise summary ('[READ] RCA for the worst statement digest, with cause + action'), followed by a brief explanatory paragraph and a structured Args list. Every sentence adds value, and the length is appropriate for the parameter complexity.

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

Completeness5/5

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

The tool has 4 optional parameters, no annotations, and no output schema, but the description explains the input modes, selection criteria, and output type ('cited causes and concrete actions'). It provides enough context for an agent to invoke the tool correctly, including how to do offline analysis and how to use EXPLAIN.

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 schema has zero property descriptions, but the description includes a dedicated 'Args' section that explains all four parameters. For example, 'statements: Injected digest rows (as from top_queries); if omitted, the worst statements are pulled live' adds meaning beyond the bare schema. This fully compensates for the schema coverage gap.

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 explicitly states 'RCA for the worst statement digest, with cause + action' and elaborates that it picks the digest with greatest total time and maps metrics to cited causes and actions. This clearly distinguishes it from sibling RCA tools like lock_wait_rca and replication_lag_rca, which focus on different resources (lock waits, replication lag).

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?

The description provides clear context for when to use the tool: for root cause analysis of the slowest statement digest. It also gives specific mode guidance: 'Pass statements for pure/offline analysis, or omit to pull the top digests live from performance_schema.' However, it does not explicitly list alternative tools or exclusion criteria beyond this.

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/MySQL-AIops'

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