Skip to main content
Glama

slow_query_rca

Read-only

Analyze the worst MySQL statement digest to identify root causes and get cited, actionable fixes using performance_schema metrics, lock/index ratios, spills, 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

NameRequiredDescriptionDefault
limitNo
targetNo
statementsNo
explain_sqlNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations only carry readOnlyHint=true, so the description carries most of the burden and does add context: it marks the tool [READ], discloses the live-vs-injected execution mode and its data source (performance_schema), and enumerates the metrics it derives. It does not warn about the cost/impact of the live pull or describe output shape, so it is strong but not exhaustive.

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?

Front-loaded with the purpose, then mechanics, then an Args block — a sensible ordering. Slightly redundant: the injected-vs-live behavior is stated once in the prose and again for the statements parameter, costing a bit of space without adding information.

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?

There is no output schema, but the description explains the return content (cited causes plus concrete actions) and the analytical signals used, which is enough for an agent to know what it will get. A brief note on result size or cost of the live path would close the remaining gap.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate and largely does: Statements (injected digest rows, format tied to top_queries), explain_sql (plan access types feed the RCA), limit (only applies when not injected, default 20), target (config target name, omit for default). 'Target name from config' is the weakest entry but still actionable.

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?

States a specific verb and resource ('RCA for the worst statement digest, with cause + action') and immediately scopes it: picks the digest with the greatest total time and maps specific numeric signals to causes. This is clearly distinguishable from siblings like top_queries (which lists), explain_query (which returns a plan), and lock_wait_rca (a different RCA domain).

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?

Gives an explicit branching rule: pass 'statements' for pure/offline analysis, or omit to pull the top digests live from performance_schema, and names top_queries as the source format. It does not explicitly state when a sibling (e.g. lock_wait_rca or explain_query) is the better choice, so it stops short of full alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.