Skip to main content
Glama

compare_query_plans

Read-onlyIdempotent

Compare two query plans to reveal differences in operators, duration, CPU, and I/O. When plan IDs are omitted, automatically contrasts the best and worst performing plans.

Instructions

Compare two query plans side-by-side: operators, duration, CPU, I/O. If plan IDs not specified, compares best vs worst plan by duration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
query_idYesQuery Store query_id.
plan_id_aNoFirst plan_id to compare (optional, uses best by default).
plan_id_bNoSecond plan_id to compare (optional, uses worst by default).
database_nameNoOptional database name. Defaults to AZURE_SQL_DEFAULT_DATABASE.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the description does not need to repeat safety. It adds valuable behavioral context by specifying the default comparison logic (best vs worst plan by duration) and listing the exact metrics included in the comparison. This enriches the annotation coverage without contradicting it.

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 only two sentences and gets straight to the point. The first sentence states the main action and outputs; the second adds the important default behavior. No filler or redundant information.

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 moderate complexity, the description covers the core purpose, default behavior, and comparison metrics. The output schema exists, so return values are handled separately. It could mention that both plans must belong to the same query_id or how to use one plan ID, but these are implied by the schema and not major gaps.

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 100%, so the baseline is 3. The description goes beyond the schema by clarifying that the 'best' and 'worst' plan defaults are determined specifically by duration, which is not stated in the parameter descriptions. This adds meaningful context for how plan_id_a and plan_id_b behave when omitted.

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 ('Compare') and resource ('two query plans side-by-side') and lists concrete comparison dimensions (operators, duration, CPU, I/O). It clearly distinguishes from sibling tools like compare_query_results (which compares result sets) and compare_plan_summaries (which likely summarizes plans). The additional note about defaulting to best vs worst plan by duration further clarifies purpose.

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: you use this when you need a side-by-side comparison of two query plans with specific metrics. It also explains the default behavior when plan IDs are omitted. However, it does not explicitly mention when not to use it or name alternatives like compare_plan_summaries, so it stops short of a full 5.

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