execute_write_query
Run INSERT, UPDATE, DELETE, or DDL statements on a write-mode database with a required dry-run preview and rollback before committing changes.
Instructions
Run an INSERT/UPDATE/DELETE/DDL statement on a write-mode database.
Know the schema before you write: if the exact table and column names are not already in this conversation, call get_table_schema first instead of guessing — a wrong name wastes a whole dry-run round-trip. Don't re-fetch a schema you already have.
SAFETY — the server enforces this flow; you cannot skip it silently:
Call with dry_run=true (the default): the statement executes inside a transaction and is ALWAYS rolled back, returning the rows_affected it WOULD have had. This records a preview grant for this exact statement.
Show the user the exact SQL and the dry-run result; ask for permission (not needed if the database has yolo enabled).
Call again with dry_run=false (and user_consent=true unless yolo) to commit. Commits without a prior dry-run of the identical statement are REJECTED. The preview grant expires 10 minutes after the dry-run and is consumed by the commit ATTEMPT it authorizes — including a commit that FAILS, which may still have applied server-side, so you MUST dry-run again before retrying. Running the same statement twice means previewing it twice. Pass skip_dry_run=true ONLY if the user explicitly asked to skip the preview.
Pass values via params ($1/$2/... placeholders), not pasted into the SQL.
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": {
"database": "<database>",
"sql": "<sql>"
},
"name": "execute_write_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| params | No | ||
| dry_run | No | ||
| database | Yes | ||
| timeout_ms | No | ||
| skip_dry_run | No | ||
| user_consent | No |