Skip to main content
Glama
sqlscope-mcp

sqlscope-mcp

by 0xmortuex

explain_query

Read-onlyIdempotent

Shows a SELECT/WITH query's execution plan without running it, with plain-language findings on full table scans, temporary sorts, automatic indexes, and CREATE INDEX suggestions.

Instructions

Show the execution plan of a SELECT / WITH query without running it (EXPLAIN QUERY PLAN), as an indented tree, followed by plain-language findings: full table scans (with row counts), temporary B-tree sorts for ORDER BY / GROUP BY / DISTINCT, and automatic indexes SQLite has to build on every run. Missing-index suggestions are returned as CREATE INDEX text only; nothing is ever created.

Input Schema

NameRequiredDescriptionDefault
sqlYes
pathYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true and destructiveHint=false, but the description adds genuinely new behavioral detail: missing-index suggestions come back as CREATE INDEX text only, nothing is ever created, and automatic indexes are rebuilt on every run. It correctly avoids restating the read-only guarantee.

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?

Purpose and the 'without running it' qualifier are front-loaded, and the parenthetical EXPLAIN QUERY PLAN anchors the operation. The trailing findings list is a single run-on sentence that could be tightened, but every clause conveys substantive 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?

With an output schema present and rich annotations, the description only needs to cover intent and quirks, which it does well. The one notable gap is the undocumented 'path' parameter, which neither the schema nor the description explains.

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 0%, so the description has to carry the parameter burden. It usefully constrains 'sql' to SELECT/WITH statements (a real restriction absent from the schema), but says nothing about 'path', which an agent must guess is the database file to inspect.

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 names the exact operation ('Show the execution plan of a SELECT / WITH query without running it (EXPLAIN QUERY PLAN)') and the output shape (indented tree plus plain-language findings), which cleanly separates it from the sibling 'query' tool that actually executes SQL.

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?

It gives clear context for use – inspect a SELECT/WITH plan without executing it – and implicitly positions itself as a pre-flight analysis step versus running the query. It never explicitly names the 'query' sibling or states when-not to use it, so it stops short of full routing guidance.

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