Skip to main content
Glama

analyze_explain_plan

Parse PostgreSQL or MySQL EXPLAIN/ANALYZE output to identify execution bottlenecks and generate a Mermaid plan flowchart for query tuning.

Instructions

Parse PostgreSQL or MySQL EXPLAIN / EXPLAIN (ANALYZE, BUFFERS) output (Text or JSON) to identify execution bottlenecks (Seq Scan, External Disk Sort, Heap Fetches, Row Misestimations) and generate a Mermaid plan flowchart.

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": {
      "dialect": "<dialect>",
      "explain_output": "<explain_output>"
    },
    "name": "analyze_explain_plan"
  }
}

Input Schema

NameRequiredDescriptionDefault
dialectYes
sql_queryNo
explain_outputYes
existing_schema_ddlNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/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 what is detected (Seq Scan, External Disk Sort, Heap Fetches, Row Misestimations) and that it returns a Mermaid flowchart, but says nothing about limitations, whether ANALYZE executes anything, or how the DDL input changes behavior.

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?

A single dense sentence with the action front-loaded and no filler; every clause (formats accepted, bottleneck classes, flowchart output) adds information an agent needs.

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 and no annotations, the description must carry more weight. It covers the return artifact (bottleneck list plus Mermaid flowchart) adequately, but leaves half the input contract (sql_query, existing_schema_ddl) unexplained and gives no guidance on output structure or size limits.

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

Parameters2/5

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

Schema coverage is 0%, so all four parameters depend on the description. Only 'dialect' is effectively explained via 'PostgreSQL or MySQL'; 'sql_query' and 'existing_schema_ddl' are completely unmentioned, and it is unclear whether existing_schema_ddl is required for accurate misestimation analysis or optional enrichment.

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 (Parse) with named resources (PostgreSQL/MySQL EXPLAIN / EXPLAIN (ANALYZE, BUFFERS) output) and enumerates the concrete outputs: bottleneck identification and a Mermaid plan flowchart. This is clearly distinct from siblings like recommend_indexes_for_queries or analyze_migration, though it never names or explicitly contrasts with any of them.

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 only implied: the agent can infer it should call this when it has raw EXPLAIN output to interpret, but there is no statement of when to prefer it over siblings such as recommend_indexes_for_queries, nor any prerequisites (e.g. that output must come from a real run).

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