Skip to main content
Glama
qxduddes

mysql-mcp

by qxduddes

Explain query plan

explain_query
Read-only

Run MySQL EXPLAIN on a SELECT query to get the execution plan and diagnose slow queries, index usage, full scans, and missing indexes.

Instructions

Run EXPLAIN on a SELECT query and return the execution plan.

Use this tool when the user asks why a query is slow, whether an index is used, or how MySQL will execute a SELECT. Only SELECT statements are accepted (not SHOW/DESCRIBE/EXPLAIN).

Returns JSON: {format, originalSql, explainSql, rowCount, rows} where rows contain the plan.

Presentation: never mention this tool's name to the user or announce that a tool is being called — answer directly with the analysis.

Preferred rendering — card-based layout: when the client supports rich widgets or HTML artifacts, render a header card with the query, a plan table card (access type, key, rows examined), and a highlights card calling out full scans or missing indexes.

Fallback — Markdown: one-line verdict first (e.g. "uses index X"), then a compact Markdown table of the plan rows.

Formatting rules (both modes): explain the plan in plain language; never paste raw JSON unless explicitly asked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesA single SELECT statement to analyze. Use %s placeholders for bind values passed via params_json.
db_idNoOptional named database profile configured on the server.
formatNoEXPLAIN output format: 'traditional' (default) or 'json'.traditional
params_jsonNoOptional JSON array of scalar bind values for %s placeholders.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses accepted input types, output JSON structure, and presentation constraints such as 'never mention this tool's name' and 'never paste raw JSON unless explicitly asked.' This adds substantial behavioral context beyond annotations.

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 well-structured: front-loaded purpose, then usage guidance, output structure, and presentation rules. Every section earns its place, and there is no filler or repetition of schema details.

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 fully covers tool behavior: what it accepts, what it returns, how to present results, and formatting rules. With the readOnlyHint annotation and output schema present, this is complete for a read-only analysis tool.

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 covers all 4 parameters with descriptions (100% coverage), so baseline is 3. However, the description adds the critical constraint that sql must be a SELECT statement and not SHOW/DESCRIBE/EXPLAIN, which is not present in the schema. This adds meaningful parameter semantics.

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 'Run EXPLAIN on a SELECT query and return the execution plan.' This is a specific verb+resource statement that distinguishes the tool from siblings (query, describe_table) by focusing on execution plans and explicitly restricting to SELECT statements.

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

Usage Guidelines5/5

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

Explicitly states when to use: 'Use this tool when the user asks why a query is slow, whether an index is used, or how MySQL will execute a SELECT.' Also provides exclusions: 'Only SELECT statements are accepted (not SHOW/DESCRIBE/EXPLAIN).' This is clear guidance with context and alternatives.

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/qxduddes/mcp-server-mysql'

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