Explain a query
explainShows the database query plan to check index usage and, on Postgres, can run a read-only query to report actual rows and timings.
Instructions
Shows the plan the database would use for a query, to check that indexes are used. With analyze on Postgres, runs the query (read-only) and reports real timings.
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"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The query to explain: one statement, such as a SELECT. | |
| params | No | Values for the placeholders in `sql`, in order: $1, $2 on Postgres, ? on SQLite. | |
| analyze | No | Postgres only: run it and show actual rows and timings. |