Skip to main content
Glama
shadow-dba

mssql-dba-mcp

by shadow-dba

Get Execution Plan

mssql_execution_plan
Read-onlyIdempotent

Retrieve the cached execution plan (showplan XML) for a SQL Server query using its plan handle without running the query. Get the handle from mssql_top_queries first.

Instructions

Execution plan (showplan XML) of a cached query, by plan handle. Reads the plan cache only; never runs the query. Get the Plan Handle from mssql_top_queries. Large plans are cut at 35,000 characters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryPlanHandleYesHex plan handle from sys.dm_exec_query_stats (e.g. 0x060006...).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, non-destructive behavior. The description adds real context beyond them: it touches only the plan cache, never executes the query, and truncates large plans at 35,000 characters — an important disclosure that output may be incomplete.

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?

Three short sentences, each carrying distinct information: what it returns, where to get the input, and the behavioral constraints. The purpose is front-loaded and nothing is wasted.

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

Completeness5/5

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

For a single-parameter read tool with no output schema, the description supplies the return format (showplan XML), the truncation caveat, and the input provenance — everything an agent needs to call it and interpret the result.

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% and already documents the hex plan handle format, so the baseline is 3. The description adds value by naming the source tool (mssql_top_queries) where the handle comes from.

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?

Names a specific verb+resource: retrieves the showplan XML execution plan for a cached query keyed by plan handle. It is clearly distinct from siblings like mssql_run_select (executes queries) and mssql_top_queries (lists queries).

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?

Explicitly states the prerequisite chain — the plan handle must be obtained from mssql_top_queries — which routes the agent correctly. It also clarifies this reads the plan cache only and never runs the query, though it doesn't name when a different tool would be preferred.

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