Skip to main content
Glama
igorolv

jdbc-mcp-server

analyzePlan

analyzePlan
Read-onlyIdempotent

Diagnose query-plan performance from SQL execution plans: find expensive nodes, full scans, estimation errors, risky nested loops, and disk-sort spills.

Instructions

Diagnose query-plan performance with compact structured findings: expensive nodes, large-table full scans, estimation errors, risky nested loops and disk-sort spills. Use explainQuery when the full textual plan is required. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
paramsNoValues for '?' placeholders, in order.
analyzeNoExecute the query to collect runtime stats where supported (default false).
connectionYesDatabase to run against. Call listConnections for valid names; do not guess.
namedParamsNoValues for ':name' placeholders, keyed by name.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rootNoRoot node of the execution plan.
engineNoDatabase engine that produced the result, such as PostgreSQL, Oracle, SQL Server, Firebird, or SQLite.
analyzedYesTrue when the plan includes actual execution metrics, not only estimates.
fullScansNoPlan nodes that perform full table or index scans and may deserve attention.
nodeCountYesNumber of table nodes in the schema graph.
diskSpillsNoSort or hash nodes that appear to spill to disk.
planningTimeMsNoPlanner time reported by the database, in milliseconds when available.
executionTimeMsNoExecution time reported by the database, in milliseconds when available.
estimationErrorsNoPlan nodes where actual rows differ materially from estimated rows.
riskyNestedLoopsNoNested-loop nodes that may be expensive because the outer side is large.
topExpensiveNodesNoPlan nodes ranked as most expensive by cost or actual time.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.0
    • changedOutput schema / properties / engine / description
      Previous value: -"Database engine that produced the result, such as PostgreSQL, Oracle, or SQL Server."New value: +"Database engine that produced the result, such as PostgreSQL, Oracle, SQL Server, Firebird, or SQLite."
  2. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already establish the safety profile (readOnlyHint=true, idempotentHint=true, destructiveHint=false), so the bar is lower. The description adds real behavioral context by specifying the compact structured nature of the output and the five diagnostic categories, though it does not warn that analyze=true executes the query or discuss cost.

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?

Front-loads the purpose, then alternates, then parameter binding rules in a compact block. Slightly dense and telegraphic in the second half, but every sentence carries information and nothing is padded.

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?

With an output schema present, the description need not explain returns, and it covers purpose, the sibling alternative, and the trickiest parameter binding. The one notable omission is the runtime/execution implication of analyze=true for what is otherwise a read-only diagnostic.

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 coverage is 80%, so the baseline would be 3, but the description adds genuine value: it explains the placeholder convention ('?'->params, ':name'->namedParams), forbids mixing them, and clarifies the namedParams key is the bare name (':status' -> {status:'PAID'}), which resolves a real ambiguity in the schema.

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 (diagnose) and resource (query-plan performance) and enumerates the concrete findings returned: expensive nodes, full scans, estimation errors, nested loops, sort spills. It also distinguishes itself from explainQuery, so an agent can select it without reading another schema.

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 routes the agent to explainQuery 'when the full textual plan is required,' giving a clear when-to-use-this-vs-that condition. It does not mention other plausible siblings (inspectQuery, queryLint), so the guidance is strong but not exhaustive.

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