Run SQL
run_sqlRun one PostgreSQL SELECT over this company's copy and answer its rows, to explore the data and to write a
report's sql block. Each source is a schema named by list_connections' sql_schema (simpro, xero, verizon_connect, the_fleet_office, deputy, moveware, dialpad, elmo, employment_hero, emailed_reports),
holding one view per resource named and shaped as describe_resources lists it, plus data, the whole
document as the source sent it (jsonb: data->>'Name', data#>>'{Customer,ID}'). Name the sources read with
connection_ids; the first one's schema is also the default, so jobs reads simpro.jobs. Joins, CTEs, window
functions and every read-only function work. period_start() and period_end() answer a report block's period.
Tax file numbers, bank details and birth dates are removed from every document. Nothing can be written, and
a query runs at most 15s. Dates a source sent as text compare as text: date_issued >= '2026-07-01'.
At most 200 rows answer at once, and truncated true means more remain: read on with ORDER BY and
OFFSET in the SQL, and count or total with COUNT(*), SUM and GROUP BY rather than reading every row.
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": "run_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One SELECT (or WITH ... SELECT), no semicolons between statements. | |
| limit | No | Rows to answer. Default and most 200. | |
| connection_ids | No | The sources it reads. Omit when the company has one. |