Skip to main content
Glama
database-mcp

database-mcp

explain_query

Dry-run a SQL query to return its execution plan and warnings—like missing LIMIT or sequential scans—so you can verify validity and sanity before running expensive queries.

Instructions

Dry-run a SQL query: returns the query plan (EXPLAIN — nothing is executed) plus warnings (missing LIMIT, sequential scans). Use to verify a query is valid and sane before run_query on anything expensive.

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": {
      "connection": "<connection>",
      "sql": "<sql>"
    },
    "name": "explain_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYes
connectionYesNamed connection from list_connections (preferred) or a raw connection string.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.5

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that nothing is executed, that the return is a query plan plus warnings, and names concrete warning categories (missing LIMIT, sequential scans). It stops short of stating cost, permission prerequisites, or whether the plan is estimated or live, which for a database tool with zero annotation coverage is a real but minor gap.

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?

Two sentences, no filler, with the safety-critical fact (nothing is executed) placed in the first clause where it will be read. Every phrase carries 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?

No output schema exists, and the description compensates by telling the agent what comes back (plan plus warnings). Safety and the run_query alternative are covered, so the only material hole is guidance on the undocumented sql parameter.

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 only 50%: connection has a description pointing at list_connections, but sql is a bare string with no schema text. The description adds the key semantic that the SQL is planned rather than executed, which shapes how the parameter should be supplied, but it never addresses connection selection or the shape/limits of the sql string.

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?

States a specific verb and resource ("Dry-run a SQL query") and immediately distinguishes the outcome: returns an EXPLAIN plan and warnings, with nothing executed. That contrast with run_query is explicit in the text, so an agent can separate the two tools without opening a schema.

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?

Gives an explicit trigger — "Use to verify a query is valid and sane before run_query on anything expensive" — and names the alternative it precedes. The conditional ("anything expensive") tells the agent when the extra step is warranted rather than mandatory.

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