Skip to main content
Glama

db_explain_query

Analyze SQL query execution plans to detect full-table scans, missing indexes, and performance bottlenecks before optimizing queries.

Instructions

Analyze query execution plan (EXPLAIN) to detect sequential full-table scans, missing indexes, and performance bottlenecks.

Input Schema

NameRequiredDescriptionDefault
sqlYesThe SQL query to explain.
paramsNoOptional parameterized query values.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full disclosure burden, yet it never says whether the query is actually executed (EXPLAIN ANALYZE) or merely planned, whether the operation is read-only, or what permissions/cost are involved. For a tool taking arbitrary SQL, that ambiguity is a meaningful safety gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler; the core action appears first and the diagnostic targets follow. It is tightly scoped, though it could have used one additional clause on usage or safety at little cost.

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?

With no output schema, the description should indicate what the analysis returns (raw plan text, findings list, recommendations), and it does not. It is adequate for a two-parameter tool but leaves the agent guessing about results and execution semantics.

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 coverage is 100%, with both `sql` and `params` documented in the input schema. The description adds nothing about parameter binding behavior or how `params` interacts with placeholders, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a concrete verb and resource (analyze execution plan via EXPLAIN) and names the specific findings it targets (sequential scans, missing indexes, bottlenecks). This clearly separates it from db_query or db_dry_run, which are about running or validating queries rather than inspecting plans, though it never explicitly names those alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit when-to-use guidance and no mention of the many siblings (db_dry_run, db_query, db_check_semantic_intent) that an agent could easily confuse with plan analysis. The purpose implies a performance-tuning scenario, but the agent must infer that context entirely.

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