Write to the workspace database
execute_sqlModify a workspace's SQLite database with CREATE, ALTER, INSERT, UPDATE, DELETE, or CREATE INDEX statements. Preview first, then pass confirm:true to execute, since dropped or deleted rows cannot be restored.
Instructions
Changes the workspace's own SQLite database: CREATE TABLE, ALTER, INSERT, UPDATE, DELETE, CREATE INDEX. Use query_database for anything that only reads.
There is no undo. A restore point reverts blocks, links and files — never rows — so a DROP or a DELETE here is permanent. Requires confirm:true; call without it first to preview.
Schema meant for a block should be idempotent, because the block runs before anybody has set anything up and a FORK of the workspace starts with an EMPTY database (the code is copied, the rows never are): CREATE TABLE IF NOT EXISTS tasks (id INTEGER PRIMARY KEY, title TEXT NOT NULL).
LOADING MANY ROWS: one statement per batch, the rows passed as ONE JSON parameter and unpacked by json_each — never one INSERT per row. Measured 2026-10-24: 36 262 rows in batches of 4 000 at ~2 s a batch. sql: INSERT INTO place (code, name, lat, lon) SELECT j.value->>'$.code', j.value->>'$.name', j.value->>'$.lat', j.value->>'$.lon' FROM json_each(@rows) AS j params: { rows: "[{"code":"75056","name":"Paris","lat":48.86,"lon":2.35}, …]" } (a JSON STRING) Make a reload idempotent (INSERT OR REPLACE, or DELETE then INSERT) so a batch that failed can simply be sent again.
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": {
"workspaceId": "<workspaceId>",
"sql": "<sql>"
},
"name": "execute_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One statement to run. Many rows: INSERT … SELECT … FROM json_each(@rows). | |
| params | No | Values for the @name placeholders. | |
| confirm | No | Must be true to run it. Omit/false returns a preview only. | |
| workspaceId | Yes |