Skip to main content
Glama

benchmark_query_rewrite

Read-only

Benchmark a baseline SQL query against a proposed rewrite using actual plan samples and snapshot equivalence to validate performance improvements.

Instructions

Benchmark a baseline query against a proposed rewrite using the same typed read-only execution path, interleaved actual-plan samples, and complete bounded snapshot equivalence.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
runsNoScreening executions per side (2-3). Metrics become per-run medians with min/max spread, so a single lucky run cannot masquerade as a win. The workflow does not clear Azure SQL caches.
analyzeNoWhen true, execute both queries to capture actual plans.
rewrite_sqlYesCandidate semantically equivalent rewrite.
baseline_sqlYesOriginal read-only SQL query.
compare_orderNoCompare result rows in returned order. Set false only when the query contract does not require ordering.
database_nameNoOptional database name. Defaults to AZURE_SQL_DEFAULT_DATABASE.
include_raw_xmlNoInclude raw SHOWPLAN XML inline. Defaults to artifact URI only.
parameter_typesNoOptional exact SQL types shared by baseline and rewrite.
auto_bind_paramsNoBind @param placeholders from column statistics where possible.
parameter_valuesNoExplicit parameter values for both baseline and rewrite.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
headlineYes
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 need not restate safety. It adds meaningful behavioral context by explaining the methodology: executing both queries on the same typed read-only path, interleaving actual-plan samples, and verifying complete bounded snapshot equivalence. This goes beyond annotations by disclosing the comparison approach and the nature of the benchmark, though it stops short of detailing every execution side-effect.

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, well-structured sentence that front-loads the primary action ('Benchmark') and packs essential details efficiently without redundancy. Every clause adds value, making it appropriately concise.

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 complexity (10 parameters) and the presence of a detailed schema with 100% coverage, the description is fairly complete. It communicates the core purpose and high-level behavior, but could be more robust by explicitly positioning the tool within the workflow (e.g., when to use versus benchmarking tuning/index candidates). Overall, it provides enough context for an agent to infer when and how to invoke it, especially with the schema's supplementary details.

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%, so the baseline is 3. The description does not add significant parameter-specific meaning; it refers overall to the benchmarking process rather than individual parameters. The schema already has rich descriptions for all 10 parameters (e.g., 'runs' explains medians, 'analyze' captures plans), so the description's contribution is marginal.

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's verb and resource: 'Benchmark a baseline query against a proposed rewrite'. It distinguishes from siblings like 'benchmark_tuning_candidate' and 'benchmark_index_candidate' by focusing on query rewrites, and includes specific methodological details (typed read-only path, interleaved plan samples, snapshot equivalence) that define its scope.

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 use case is implied: benchmark a rewrite against a baseline. However, there is no explicit guidance on when to use this tool versus alternatives, nor any exclusions or prerequisites. The description implies usage for query rewrites but does not state 'use this when...' or mention alternatives. The parameter descriptions in the schema provide some conditional guidance (e.g., 'compare_order'), but the main description lacks explicit usage context.

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