Explain Query
explainQueryGet an execution plan for a slow SQL query to diagnose performance issues. Understand how tables are scanned, indexes used, and where to add indexes.
Instructions
Return the execution plan for a SQL query to diagnose performance. Use this tool instead of running EXPLAIN directly through readQuery — it provides structured output via EXPLAIN QUERY PLAN.
<when_not_to_use>
Running actual queries → use readQuery or writeQuery
Checking table structure → use getTableSchema </when_not_to_use>
<what_it_returns> A JSON array of EXPLAIN QUERY PLAN rows showing how SQLite will scan tables, use indexes, and order operations. </what_it_returns>
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": {
"query": "<query>"
},
"name": "explainQuery"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The SQL query to explain. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | Result rows, each a JSON object keyed by a column name. |