Explain query plan
explain_queryInspect PostgreSQL query plans to debug performance: show the planner's JSON plan for one SQL statement without executing it, or run EXPLAIN ANALYZE on read-only queries for real timings.
Instructions
Show the planner's JSON plan for one statement (SELECT/WITH/VALUES/TABLE, or INSERT/UPDATE/DELETE/MERGE — not executed). analyze: true executes read statements inside a rolled-back READ ONLY transaction for real timings. Refused while POSTGRES_SCHEMA_ALLOWLIST is set.
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": {
"sql": "<sql>"
},
"name": "explain_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The statement to explain | |
| params | No | Values for $1, $2 … placeholders | |
| analyze | No | Run EXPLAIN ANALYZE, BUFFERS (read statements only; default false) |