Run a read-only SQL query
queryRun read-only SQL queries against the shop database to retrieve matching rows as JSON, with pagination and SQL aggregation for totals, top-N, or revenue.
Instructions
Execute a read-only SQL query against the shop database and return the matching rows as JSON objects.
Returns: columns (list of names), rows (list of objects), row_count, truncated (true when more rows exist beyond the limit) and, when truncated, next_offset for fetching the next page.
Use list_tables / describe_table first to learn the schema. For questions like totals, top-N or revenue, aggregate in SQL (SUM, COUNT, GROUP BY, ORDER BY, LIMIT) instead of fetching raw rows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single SQLite SELECT statement (WITH ... SELECT is allowed). JOINs, GROUP BY and aggregate functions are supported. Any data-modifying statement is rejected — the database is read-only. | |
| limit | No | Maximum rows to return, 1-500 (default 50). Prefer aggregating in SQL over fetching many raw rows. | |
| offset | No | Rows to skip for pagination (default 0). Use next_offset from a truncated result. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||