export_data
DOWNLOAD or EXPORT query results as a private CSV file the user can open in Excel. THIS is the tool for "download it", "export it", "can I get this as a CSV/spreadsheet", "save this", "send me the data", or "give me the full data" — NOT share_artifact, which publishes to a public web page and will refuse a download request. Pass the read-only SELECT whose rows you want as sql (same rules and scan limits as execute_sql; to export a stored result use SELECT * FROM scratch.<scope>__<name> and include the same question_id you used there). Optionally pass a filename. The file holds up to 1000000 rows (and 24 MB), far more than execute_sql returns, because the rows go to the file and not back to you. So export the whole range the user asked for in ONE call and give them ONE link; do not split it by month or date range to stay under the execute_sql cap. Returns download_url — a private link, unlisted and not indexed, that expires in a day. Give it to the user and suggest they save the file. If the response carries truncated, the row cap was hit and the file is incomplete — say so, and offer to export the rest in date ranges. If it refuses with export too large, split exactly as it says: files_needed exports of at most max_rows_per_file rows, using suggested_split when given; do not guess a split of your own.
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": "export_data"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The read-only SELECT whose rows become the file. Same rules and scan limits as `execute_sql`, but a much larger row cap (the rows go to the file, not back to you), so one call can export a full year of 5-minute data. Export the rows the user actually wants rather than a whole table. To export a stored result, this is just `SELECT * FROM scratch.<scope>__<name>`. | |
| filename | No | Optional filename for the download, e.g. "ladbroke_constraints". The `.csv` suffix is added if absent, and unsafe characters are stripped. | |
| question_id | No | The `question_id` from `start_question`. Required when `sql` references a `scratch.*` table, exactly as for `execute_sql` — it is what proves the stored result is yours. |