query_plan
Retrieve the execution plan for a SQL query without executing it. Supports PostgreSQL, MySQL, and Redshift, returning JSON or text plans for query optimization.
Instructions
Get the execution plan (EXPLAIN) for a SQL query without running it. postgres/mysql return a JSON plan; redshift returns a text plan (Redshift supports neither FORMAT JSON nor EXPLAIN ANALYZE, and its cost numbers are relative — do not compare them to postgres costs).
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": {
"connection": "<connection>",
"query": "<query>"
},
"name": "query_plan"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL text to explain (the query itself is not executed) | |
| database | No | Database to explain against; required when the connection declares multiple databases | |
| connection | Yes | Connection key from connection_list |