Skip to main content
Glama

Explain Query

explainQuery
Read-onlyIdempotent

Diagnose slow SQL queries by retrieving the execution plan. Understand how tables are scanned and indexes are used to optimize performance.

Instructions

Return the execution plan for a SQL query to diagnose performance. Use this tool instead of running EXPLAIN directly through readQuery — it provides structured output via EXPLAIN QUERY PLAN.

<when_not_to_use>

  • Running actual queries → use readQuery or writeQuery

  • Checking table structure → use getTableSchema </when_not_to_use>

<what_it_returns> A JSON array of EXPLAIN QUERY PLAN rows showing how SQLite will scan tables, use indexes, and order operations. </what_it_returns>

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe SQL query to explain.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYesResult rows, each a JSON object keyed by a column name.
Behavior5/5

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

Annotations already declare safe read-only behavior; description adds output format (EXPLAIN QUERY PLAN JSON array) and no side effects, reinforcing transparency.

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?

Well-structured with sections, front-loaded purpose, and concise. Each section adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers all necessary context: purpose, when-to-use, when-not-to-use, examples, and output format. Output schema exists but description explains its content.

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 covers 100% of query parameter with description. Description adds usage context but no new semantic constraints beyond schema.

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?

Clearly states returning execution plan for SQL performance diagnosis. Distinguishes from siblings like readQuery and getTableSchema via explicit sections.

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

Usage Guidelines5/5

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

Provides explicit use cases, when-not-to-use, and alternative tools. Examples clarify correct invocation.

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/haymon-ai/dbmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server