Skip to main content
Glama
sql-mcp

sql-mcp

by hogiabao2601

explain_query

Read-only

Shows a SELECT query's execution plan without running it, revealing full scans, indexes used, and estimated rows so you can judge and fix slow queries.

Instructions

Show the database's execution plan for a SELECT without running it. On MySQL look at 'type' (ALL = full scan), 'key' (index used), and 'rows' (estimated rows) to judge whether a query is slow.

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": {
      "query": "<query>"
    },
    "name": "explain_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes
schemaNo
profileNo
databaseNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered by structured data. The description adds a genuinely useful behavioral fact beyond that: the statement is not executed, and it tells the agent how to interpret the result via 'type', 'key', and 'rows'. It doesn't mention engine differences beyond MySQL or error behavior, so a 4 rather than 5.

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?

Two tight sentences with no filler, and the core behavior ('without running it') is front-loaded. The second sentence is useful but engine-specific and slightly narrows the tool's apparent general applicability.

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?

With no output schema, the description partially compensates by naming key plan columns to inspect. But three of four parameters are undocumented and the behavior of 'profile' versus a standard plan is unexplained, leaving meaningful gaps for correct invocation.

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

Parameters2/5

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

Schema description coverage is 0% across four parameters, so the description must carry the burden and it largely doesn't. Only 'query' is implicitly addressed (as a SELECT); 'schema', 'profile', and 'database' — including how 'profile' differs from a plain plan — are never explained anywhere.

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 names a specific verb and resource ('Show the database's execution plan for a SELECT') and the qualifier 'without running it' distinguishes it from the sibling execute_query. An agent can tell immediately which tool produces a plan versus which runs a query.

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?

It gives a clear use case: run this to 'judge whether a query is slow.' The contrast with execute_query is implied rather than named, and there are no explicit exclusions or prerequisite notes, keeping it just short of a 5.

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