export_query
Run a SQL query and stream results directly to a CSV or JSONL file on disk, using constant memory and zero tokens for large data exports.
Instructions
Execute a SQL query and stream results directly to a local CSV or JSONL file on disk. Zero token consumption, constant O(1) memory usage, ideal for large query exports.
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>",
"target_file": "<target_file>"
},
"name": "export_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| db | No | Optional path to SQLite database file. Defaults to configured default database. | |
| sql | Yes | The SQL query to execute and export to disk. | |
| format | No | Export file format: 'csv' (comma-separated values) or 'jsonl' (line-delimited JSON). | csv |
| params | No | Optional query parameters (positional list, named dict, or JSON string). | |
| target_file | Yes | Destination file path on disk (e.g. 'output.csv' or 'data.jsonl'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |