Skip to main content
Glama

Get Query Execution Plan

get_query_plan
Read-onlyIdempotent

Retrieve XML execution plans for SELECT queries. Choose estimated plans to preview the optimizer's strategy or actual plans to view runtime statistics.

Instructions

Get the estimated or actual XML execution plan for a SELECT query. Estimated plans show the optimizer's plan without executing. Actual plans execute the query and include runtime statistics. Uses the same query validation as read_data (SELECT only).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverNameYesName of the SQL Server to query (use list_servers to see available names)
queryYesSQL SELECT query to get the execution plan for. Only SELECT and WITH (CTE) queries are permitted.
databaseNameYesName of the database to query (use list_databases to see available databases)
outputPathYesFile path for output (e.g. '/tmp/plan.sqlplan')
planTypeNoPlan type: 'estimated' (default, does not execute) or 'actual' (executes the query)estimated
Behavior4/5

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

Adds specifics beyond annotations: estimated plans don't execute, actual plans execute with runtime stats, and validation restricts to SELECT. No contradiction with readOnlyHint and idempotentHint.

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?

Two concise sentences that front-load the core purpose and efficiently cover key details without redundancy.

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?

No output schema, but description omits return value or success indication after saving to outputPath. Adequate but not fully complete for an agent's invocation.

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 coverage is 100%, so baseline is 3. The description adds value by clarifying planType behavior and default, which enhances understanding beyond schema.

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 retrieves estimated or actual XML execution plans for SELECT queries, distinguishing between plan types and stating it uses same validation as read_data.

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?

Provides context for when to use each plan type and validation constraint, but lacks explicit exclusion of alternatives or when-not-to-use scenarios.

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/mbentham/SqlAugur'

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