Skip to main content
Glama

explain_query

Retrieve a JSON execution plan for a SQL statement to analyze query performance without running it.

Instructions

[READ] Return the JSON execution plan for sql (EXPLAIN FORMAT=JSON).

The statement is planned, not executed.

Args: sql: A single SQL statement to EXPLAIN. target: Target name from config; omit for the default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
targetNo
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses the key behavioral trait that the statement is not executed, which is crucial for safety. However, it does not mention potential permission requirements or behavior on invalid SQL, leaving some gaps.

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 concise, front-loaded with purpose, and includes a clear args section. Every sentence serves a purpose without any fluff.

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?

Given the tool's simplicity (2 params, no output schema), the description covers the main inputs and the crucial non-execution behavior. It lacks details about the exact structure of the returned JSON or any restrictions on SQL statement types, but is reasonably complete for typical use.

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 description coverage is 0%, so the description's documentation of 'sql' and 'target' adds essential meaning beyond the bare schema types. It explains sql as a single SQL statement and target as an optional config target, though the meaning of 'target' could be clearer.

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 returns the JSON execution plan for a given SQL statement via EXPLAIN FORMAT=JSON. It uses a specific verb ('return') and resource ('JSON execution plan'), and explicitly says the statement is planned, not executed, distinguishing it from other tools that actually run queries or perform mutations.

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?

The description provides clear context for when to use this tool (to obtain query plans) and implies it is safe because the statement is not executed. It does not explicitly mention alternatives or when not to use it, but the context is clear enough for an AI agent.

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