query_d1
Execute SQL statements on a D1 database with bound parameters. Human approval gate ensures safety: set confirm:true to commit changes, otherwise preview results.
Instructions
Execute a SQL statement against a D1 database (with optional bound params). Requires confirm:true (human-approval gate); without it returns a preview only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | No | Cloudflare account ID. Falls back to CLOUDFLARE_ACCOUNT_ID env var when omitted. | |
| database_id | Yes | D1 database ID (from list_d1_databases). | |
| sql | Yes | The SQL statement to execute. | |
| params | No | Bound parameters for '?' placeholders in the SQL. | |
| confirm | No | Human-approval gate: must be true to actually perform this mutating operation. Omit or set false to get a non-executing preview of what would happen (with secrets redacted). A human should approve before this is set to true. |