Skip to main content
Glama
S-CurveLabs

io.github.S-CurveLabs/sqlglass

Official
by S-CurveLabs

explain_query

Read-only

Compile a query to an estimated plan, surfacing expensive operators, big-table scans, key lookups, sorts, implicit conversions, warnings, and missing-index suggestions without executing it.

Instructions

Estimated execution plan, summarised: the expensive operators, scans on big tables, key lookups, sorts, implicit conversions, optimizer warnings and missing-index suggestions. The query is compiled, NOT executed, so this is safe on heavy queries. (SQL Server login needs the SHOWPLAN permission.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlNo
queryNo
paramsNo
connectionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already mark readOnlyHint=true, and the description reinforces this by stating the query is NOT executed and safe on heavy queries. It adds the SHOWPLAN permission requirement, which is not in annotations, providing valuable behavioral context beyond structured fields.

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 two sentences with no fluff. The primary purpose and key constraints are front-loaded, and the list of plan elements is compact yet informative. Every sentence earns its place.

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?

The description gives a good overview of the tool's behavior and safety, and lists the kind of plan output. However, it lacks any parameter guidance (especially the distinction between sql and query, and the connection field) and does not describe the output format. For a tool with 4 params and no output schema, this is a moderate gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the description makes no mention of the four parameters (sql, query, params, connection). It provides zero guidance on what each parameter is for, how they interact, or which are required. The agent is left entirely to guess parameter semantics.

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 produces an estimated execution plan summary, enumerating specific elements (expensive operators, scans, key lookups, sorts, implicit conversions, warnings, missing-index suggestions). This is a distinct, concrete purpose that differentiates it from siblings like run_query (executes) or lint_sql (static analysis).

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 notes the query is compiled, not executed, and calls out safety on heavy queries, which implies a use case for performance analysis without side effects. However, it does not explicitly contrast with alternative tools (e.g., run_query, analyze_sql) or state when not to use it, leaving some inference to the agent.

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