Skip to main content
Glama

top_queries

Read-only

Retrieve ranked MySQL/MariaDB statement digests from performance_schema by metrics like total_time, mean_time, or calls to spot slow or high-load queries.

Instructions

[READ] Top statement digests from performance_schema by a whitelisted metric.

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

Returns an envelope: {"statements": [...], "returned": N, "limit": L, "truncated": bool}. When "truncated" is true there is more beyond what was returned — re-run with a higher limit rather than treating this as the complete picture.

Input Schema

NameRequiredDescriptionDefault
limitNo
targetNo
order_byNototal_time

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4/5.0
Behavior4/5

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

Annotations cover only readOnlyHint, so the description does real work: it discloses the result envelope shape, the meaning of the 'truncated' flag, and the correct recovery action (re-run with a higher limit). That is genuine behavioral context beyond the annotations, with the only gap being no mention of permissions or cost.

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 a [READ] tag, then Args, then Returns — clean and scannable with no filler. Slightly longer than strictly necessary, but every section (especially Returns, since there is no output schema) earns its place.

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?

With no output schema, the description correctly supplies the return shape and truncation semantics, and it fully documents all three parameters. The remaining gap is the undefined 'whitelisted metric' concept and no note on error behavior or target naming.

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?

Schema description coverage is 0% and contains no enum for order_by, so the description carries the full burden — it enumerates all six valid order_by values, gives the limit range (1..200) and default (20), and explains that target comes from config and defaults when omitted.

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?

States a specific verb+resource: top statement digests from performance_schema, ranked by a metric. This is distinguishable from read-only diagnostic siblings, though it never names or contrasts the closest alternatives (slow_query_rca, long_running_queries), so a 4 rather than 5.

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?

Usage is implied by the metric-selection framing, and the description does give operational guidance for the truncated case. However it never says when to reach for this tool versus slow_query_rca or long_running_queries, and 'whitelisted metric' is left undefined, so it stays at minimum-viable rather than explicit.

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