explain_query
Inspect PostgreSQL query execution plans to identify performance issues. Run EXPLAIN or EXPLAIN ANALYZE on any SELECT statement to see how the database executes it, helping you optimize slow queries before deployment.
Instructions
Run EXPLAIN (or EXPLAIN ANALYZE) on a query and return the plan.
Args: sql: The SELECT query to explain. analyze: If True, actually executes the query to get runtime stats (EXPLAIN ANALYZE). Default: False (plan only, no execution).
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 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |