Skip to main content
Glama

explain_query

Read-only

Retrieve the PostgreSQL query plan for one read-only SQL statement without executing it or adding EXPLAIN; inspect execution plans before running queries.

Instructions

PostgreSQL's plan for one read-only query passed without EXPLAIN; the query is not run.

Input Schema

NameRequiredDescriptionDefault
queryYesOne SQL statement.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already cover safety (readOnlyHint=true, openWorldHint=false), yet the description adds genuinely non-redundant behavior: the caller must not prefix EXPLAIN themselves, and the query is not executed, so there are no side effects and no ANALYZE-style execution. That is exactly the kind of context annotations cannot convey.

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 compact sentence with no waste, and the key 'not executed' fact lands early via the semicolon. The pre-semicolon clause is awkwardly constructed ('plan for one read-only query passed without EXPLAIN'), costing a bit of parseability.

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

Completeness3/5

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

For a one-parameter read tool with annotations present, the description covers the essentials of what to pass and what will not happen. With no output schema, however, it says nothing about the return shape (plan node rows/text) or error behavior for invalid or write statements, which an agent would benefit from knowing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% ('One SQL statement.'), so the baseline is 3, but the description adds a real constraint the schema omits — the statement must be read-only and only one statement is accepted. It stops short of noting dialect-specific restrictions or what happens with DML input.

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?

The description names a specific resource — PostgreSQL's execution plan for a single query — and states a key behavioral fact (no EXPLAIN needed, query not executed). It is not tautological with the name, though the phrasing 'plan for one read-only query passed without EXPLAIN' is grammatically clunky and no sibling tool is mentioned for contrast.

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?

Usage is implied rather than stated: an agent must infer that this is the tool for inspecting a query's plan before/without running it. The 'read-only' and 'not run' constraints implicitly exclude write statements, but there is no explicit when-to-use, when-not, or pointer to siblings like sample_rows or describe_table for data inspection.

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