Skip to main content
Glama

top_queries

Identify slow or resource-intensive SQL by retrieving top statement digests from MySQL performance_schema, ordered by time, calls, rows examined, lock time, or no-index scans, to pinpoint optimization targets.

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

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
targetNo
order_byNototal_time
Behavior4/5

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

With no annotations, the description carries the full burden. It labels itself '[READ]', documents the return envelope including the 'truncated' flag and advises re-running with a higher limit when truncated, providing behavioral expectations beyond what the schema offers. It does not mention side effects or permissions, but for a read-only query tool, the disclosed behavior 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?

The description is efficiently structured: an initial summary, followed by parameter documentation, then return format. Every sentence adds value; there is no redundancy.

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 description is complete for the tool's complexity: it covers all three parameters, the return envelope, and the truncation behavior. Since there is no output schema, the description adequately explains the response structure.

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%, so the description fully compensates by explaining each parameter: order_by lists the allowed values, limit gives the range and default, target explains the omit behavior. This adds substantial meaning beyond the bare schema.

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 clearly states the tool's purpose: 'Top statement digests from performance_schema by a whitelisted metric', with a concrete resource (performance_schema) and specific metric list. This distinguishes it from sibling tools like long_running_queries or slow_query_rca, which focus on different aspects.

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?

The description provides clear context for what the tool does but does not explicitly state when to use it versus alternatives. It implies usage for ranking queries by a metric, but there is no exclusions or alternative tool references, so guidance is only implied.

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