explain_query
Obtain a PostgreSQL execution plan for any SQL statement to pinpoint performance issues. Use ANALYZE for real execution timing, while noting that writes like INSERT/UPDATE/DELETE will actually run.
Instructions
Get query execution plan.
Args:
sql: SQL statement to explain.
analyze: If true, actually executes the query for real timing data
(default: value of EXPLAIN_ANALYZE in .env, normally false).
WARNING: true really runs the query, including any
INSERT/UPDATE/DELETE it contains — use with care.
database_url: Database URL (optional, uses DATABASE_URL from .env if omitted).
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 | ||
| analyze | No | ||
| database_url | No |