Skip to main content
Glama
platypus-db

platypus-db

Official

explain

Returns a SQL statement's execution plan as an indented tree with costs, estimated/actual rows and times, plus index suggestions for filtered full scans.

Instructions

Returns the plan of one SQL statement: its steps as an indented tree with cost, estimated rows and, with analyze=true, actual rows and times (or JSON with format=json), then index suggestions for filtered full scans of large tables. Without analyze the statement does not run. With analyze it runs and what it changes is rolled back; on read_only connections only statements that change nothing are explained, and analyze needs PostgreSQL, MySQL, MariaDB or SQLite. max_bytes (default 32768) and timeout_seconds (default 30) work as in run_query.

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"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne SQL statement.
formatNo`text` (an indented tree, the default) or `json`.
analyzeNoRun the statement for real rows and times (`EXPLAIN ANALYZE`); what it changes is rolled back. Default false: the planner's estimates, without running it.
max_bytesNoBytes of output at most (default 32768, up to 1048576).
connectionYesThe connection's name, as `list_connections` shows it.
timeout_secondsNoSeconds the request may take before it is cancelled (default 30, up to 300).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.2

TDQS

A4.3/5.0
Behavior5/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 so well: it discloses that the default mode is non-executing, that analyze executes but rolls back changes, that read_only connections are limited to non-mutating statements, and which database engines support analyze. These are exactly the side-effect and safety facts an agent needs before calling.

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?

Three dense but front-loaded sentences: output shape first, execution semantics second, resource limits last. No filler, though the parenthetical '(or JSON with format=json)' is slightly awkward placement and the max_bytes/timeout clause is compressed into a pointer.

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?

There is no output schema, so the description responsibly describes the return shape (indented tree or JSON, cost/rows/times, index suggestions) and the execution semantics. It does not state error behavior or what happens if multiple statements are supplied despite the 'one SQL statement' constraint, which is a minor gap for a 6-parameter tool.

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% and the schema already documents format, analyze, max_bytes and timeout_seconds including defaults, so the description adds little beyond restating defaults. Its only real addition is the cross-reference that max_bytes and timeout_seconds behave as in run_query, which is useful but not self-contained for an agent that hasn't read run_query.

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?

Opens with a specific verb and resource ('Returns the plan of one SQL statement') and immediately enumerates what the result contains: steps as an indented tree with cost, estimated rows, actual rows/times, plus index suggestions. This is clearly distinguishable from run_query or estimate_change by its output being an execution plan rather than rows or estimates.

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?

Explicitly says when to set analyze=true (actual rows and times, runs the statement, rolled back) versus the default (estimates only, statement does not run), and states the backend requirement (PostgreSQL, MySQL, MariaDB, SQLite) and read_only restriction. It does not name sibling alternatives like estimate_change for plan-free cost prediction, so routing guidance is complete within the tool but not across siblings.

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