Read Query
readQueryExecute read-only SQL queries to retrieve and aggregate data from database tables.
Instructions
Execute a read-only SQL query. Allowed statements: SELECT, EXPLAIN.
<when_not_to_use>
Data changes (INSERT, UPDATE, DELETE) → use writeQuery
Query performance analysis → use explainQuery
Discovering tables or columns → use listTables or getTableSchema </when_not_to_use>
<what_it_returns> A JSON array of row objects, each keyed by column name. </what_it_returns>
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Opaque pagination cursor. Omit (or pass `null`) for the first page. On subsequent calls, pass the `nextCursor` returned by the previous response verbatim. Cursors are opaque — do not parse, modify, or persist. Ignored for `EXPLAIN` statements. | |
| query | Yes | The SQL query to execute. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nextCursor | No | Opaque cursor pointing to the next page. Absent when this is the final page, when the result fits in one page, or when the statement is a non-`SELECT` kind that does not paginate (e.g. `SHOW`, `EXPLAIN`). | |
| rows | Yes | Result rows, each a JSON object keyed by a column name. |