Skip to main content
Glama

Explain Query Plan

explain_query
Read-onlyIdempotent

Run MySQL EXPLAIN or EXPLAIN ANALYZE on read-only SELECT, WITH, or TABLE statements to inspect query execution plans and collect optional real timings.

Instructions

Run MySQL EXPLAIN (or EXPLAIN ANALYZE) on a read-only SELECT and return the plan.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "explain_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSELECT, WITH or TABLE statement to explain
analyzeNoUse EXPLAIN ANALYZE and execute the SELECT to collect real timings (default false)
jdbc_urlNoOptional JDBC URL to target a specific database (credentials embedded in URL); uses environment default when omitted

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.2.1
    • addedInput schema / properties / jdbc_url
      Added value: +{
      +  "description": "Optional JDBC URL to target a specific database (credentials embedded in URL); uses environment default when omitted",
      +  "type": "string"
      +}
  2. First observedv1.0.1

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=true, so the safety profile is covered. The description adds that it targets MySQL and that an ANALYZE variant exists, but it does not flag that ANALYZE actually executes the statement or describe the returned plan's shape — the execution caveat only appears in the schema.

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?

A single compact sentence with the verb and target front-loaded and no wasted wording. It is arguably under-specified rather than over-long, but structurally clean.

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

Completeness3/5

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

For a 3-parameter tool with full schema coverage and complete annotations, this is nearly adequate, but with no output schema the agent learns only that a 'plan' is returned — no indication of its format, size, or how to interpret it.

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

Parameters3/5

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

Schema description coverage is 100%, so all three parameters (sql, analyze, jdbc_url) are already documented in detail, including that analyze executes the SELECT and that jdbc_url carries embedded credentials. The description only echoes the EXPLAIN/ANALYZE distinction and adds no format or constraint detail beyond the schema.

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 (run MySQL EXPLAIN) and resource (query plan) and constrains the input to a read-only SELECT. An agent can tell it produces a plan rather than rows, which distinguishes it from the general query_database sibling, though no sibling is named explicitly.

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 only implied: the read-only SELECT restriction and the EXPLAIN framing suggest it is for inspecting execution plans, but there is no explicit statement of when to prefer it over query_database or the analyze_* siblings, and no stated exclusions or prerequisites.

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