Skip to main content
Glama
sql-lens-mcp

sql-lens-mcp

by varkart

explain_query

Displays the execution plan for a SQL statement without running it, helping you inspect how a database will process a query before execution.

Instructions

Show the query plan for a SQL statement without executing it

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "connectionId": "<connectionId>",
      "sql": "<sql>"
    },
    "name": "explain_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL statement to plan (without EXPLAIN prefix)
formatNoOutput format
connectionIdYesConnection ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It does disclose the one crucial trait, that the statement is not executed, which is the safety signal an agent needs. It says nothing about permissions required on the connection, cost of planning, or whether row estimates are included.

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; every clause earns its place. It is arguably too terse rather than verbose.

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?

The tool is simple: three parameters, one required connection, one required SQL string, no output schema. The description covers what the tool returns conceptually (a query plan) and that execution is skipped, which is sufficient for correct invocation.

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 all three parameters including the format enum are already documented. The description adds no meaning beyond that baseline, only implying the SQL is planned rather than run.

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 specific verb and resource: 'Show the query plan for a SQL statement'. The qualifier 'without executing it' also separates it from execute_query, so an agent can distinguish it from the sibling that actually runs SQL.

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 phrase 'without executing it' implies usage: inspect a plan without side effects. But no explicit when-to-use or exclusion guidance is given, and no alternative (such as execute_query) is named as a route for actually running the statement.

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