Skip to main content
Glama

explain_plan

Read-onlyIdempotent

Interpret a supplied PostgreSQL EXPLAIN FORMAT JSON plan to diagnose slow queries without running EXPLAIN ANALYZE or requiring database credentials.

Instructions

Interpret a supplied PostgreSQL EXPLAIN FORMAT JSON plan. Does not run EXPLAIN ANALYZE.

Input Schema

NameRequiredDescriptionDefault
planYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint=false, so the safety profile is covered. The description adds genuinely useful context beyond that: the tool does not execute or benchmark the query, so the agent learns no runtime statistics are produced and the plan must be supplied pre-formed.

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 short sentences with no filler; the core action is front-loaded and the scope exclusion follows immediately. Nothing could be removed without losing information.

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?

With no output schema, the description never indicates what the interpretation returns (e.g., structured findings vs. prose) or how large/complex plans are handled. For a single-parameter read-only tool this is adequate but leaves a real gap around the return value.

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 0%, so the schema only reveals that 'plan' is a non-empty string up to 1MB. The description compensates by specifying the expected payload is a PostgreSQL EXPLAIN FORMAT JSON plan, which is essential to invoking it correctly, though the 1MB size ceiling and JSON-parse-failure behavior remain undocumented.

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 ('Interpret') and a specific resource ('PostgreSQL EXPLAIN FORMAT JSON plan'), which is far more precise than a generic 'explain query' phrasing. The closing sentence clarifies scope by ruling out EXPLAIN ANALYZE, though it does not explicitly name which sibling (e.g., analyze_query) handles the alternative case.

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 clause 'Does not run EXPLAIN ANALYZE' supplies one clear when-not condition, implying the plan must already have been captured. However, there is no positive guidance on when to reach for this tool versus analyze_query or suggest_indexes, so usage is only partially implied.

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