Skip to main content
Glama

explain_query

Read-only

Generate estimated or actual execution plans for read-only SQL queries to diagnose performance issues and optimize query execution.

Instructions

Generate an estimated or actual execution plan for a read-only SQL query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesRead-only SQL query to explain.
analyzeNoWhen true, executes the query and returns an actual plan.
database_nameNoOptional database name. Defaults to AZURE_SQL_DEFAULT_DATABASE.
include_raw_xmlNoWhen true, includes raw SHOWPLAN XML inline. Defaults to False; use raw_xml_resource_uri for token-safe retrieval.
parameter_typesNoOptional declared SQL types keyed by parameter name, for example {'CustomerId': 'bigint'}. Supply exact types for faithful compilation.
auto_bind_paramsNoWhen true, automatically detects @param placeholders and binds them using column statistics or type-based fallback values.
parameter_valuesNoOptional JSON parameter values keyed by name (for example {'CustomerId': 42}). Values are passed as driver parameters and are not returned in the response.
hypothetical_indexesNoReserved for future use. Hypothetical index analysis is disabled on this read-only tool for safety.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
headlineYes
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds the 'estimated or actual' execution plan mode, which is useful, but it does not mention that analyze=true will actually execute the query or any other side effects beyond safety. This is a minor addition over what annotations and the schema already convey.

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 a single, focused sentence without redundant words. It front-loads the verb and resource and is appropriately sized for the tool's simplicity at a high level.

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 rich schema (100% coverage), clear annotations, and presence of an output schema, the description suffices to orient an agent toward the tool's core purpose. It does not summarize advanced parameters like parameter binding or raw XML, but these are fully documented in the schema, so the description does not need to carry that burden.

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%—every parameter has a detailed description. The main description does not add parameter-specific meaning beyond the 'read-only' qualifier, so the baseline of 3 applies.

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 uses a specific verb ('Generate') and resource ('execution plan') with a clear scope ('for a read-only SQL query'). It distinguishes the tool from siblings like execute_sql (which executes queries) and plan cache tools that retrieve existing plans.

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 implies use for read-only queries and plan analysis, but it does not explicitly state when to use this tool vs alternatives such as execute_sql or get_plan_cache_analysis. There are no exclusions or alternative tool references, only the 'read-only' qualifier as a soft usage signal.

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/akaalholdings/azure-sql-mcp'

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