write
Run INSERT, UPDATE, DELETE, or schema changes when read-only mode is off, and get affected-row counts
Execute a write SQL query (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) against a specific database. Database and table DDL such as CREATE DATABASE, DROP DATABASE, and DROP TABLE … CASCADE runs here as plain SQL; nothing stops a DROP DATABASE of the active database. While column rules exist, these statements are refused (see What gets rejected). This tool is only available when read-only mode is disabled. No SQL type validation is performed — the tool boundary is the access control.
Returns rows (rows from a RETURNING clause, otherwise empty), rowsAffected (rows inserted, updated, or deleted; 0 for schema changes), and, on MySQL/MariaDB and SQLite, lastInsertId for an INSERT that generated one. rows is capped like read output (see Output Size Caps):
{ "rows": [], "rowsAffected": 1, "lastInsertId": 42 }On MySQL/MariaDB, UPDATE counts matched rows, even when values did not change, and lastInsertId is the first id of a multi-row insert. PostgreSQL has no lastInsertId; use RETURNING id. On SQLite, lastInsertId appears only after INSERT/REPLACE; use RETURNING for WITHOUT ROWID tables and upserts.
Row keys follow the RETURNING column order, as in read.