Changes and migrations · stop 7 of 10
apply_ddl
Runs a schema change: CREATE, ALTER, DROP, TRUNCATE.
Needs admin modeTool sets: full
You might ask
“Add a deleted_at column to orders.”
Your assistant may call apply_ddl to answer.
How it works
- Needs admin mode. Runs inside a transaction, and supports
dry_run. - For a CRITICAL-risk statement such as
DROP TABLE, nexql-mcp asks you directly (MCP elicitation) when your app supports it. Otherwise the call needsconfirm_destructive: true. - Works on objects inside the connected database.
CREATE DATABASEandDROP DATABASEare refused in every mode. - Marks the schema index stale, so the next search reflects the change after a refresh.
Parameters
sqlstringrequired- A single DDL statement to apply.
confirm_destructiveboolean- Required (true) when the statement is classified CRITICAL risk by check_ddl_safety's rules (e.g. DROP TABLE, TRUNCATE), unless the client supports MCP elicitation — in that case the server asks the human directly instead of requiring this argument. Call check_ddl_safety first, or dry_run:true to preview. Not required when dry_run is true. Default false.
dry_runboolean- If true, execute then roll back so no change persists. Default false.
timeout_msnumber- Override statement_timeout for this call, in milliseconds. Unlike run_select, may exceed the profile's configured ceiling — useful for bulk INSERT/DDL. Bounded by NEXQL_MCP_MAX_TIMEOUT_MS.
What your assistant reads
The description nexql-mcp sends with the tool. It's how the assistant decides when to use it.
Apply a DDL statement (CREATE, ALTER, DROP, TRUNCATE, …) in admin mode inside a transaction. Set dry_run=true to roll back. Scope: objects within the connected database only — CREATE DATABASE / DROP DATABASE are always rejected, in every access mode.