Skip to main content

run_mutation_query

Executes INSERT, UPDATE, REPLACE, or DELETE against the provider. Real side effects - a successful call changes cloud state.

Gated by the server mode:

ModeINSERT / UPDATE / REPLACEDELETE
read_onlyrefusedrefused
safe (default)needs approval (elicitation)needs approval
delete_safeallowedneeds approval
full_accessallowedallowed

info

A payload holding several statements is gated by its most privileged statement

When a mutation needs approval and the client did not advertise the MCP elicitation capability, the call is refused.

See also: [ MCP overview ] [ run_lifecycle_operation ] [ describe_method ] [ INSERT language spec ] [ DELETE language spec ]


Inputs​

ArgumentRequiredDescription
sqlYesAn INSERT, UPDATE, REPLACE, or DELETE statement.
sourceNoQuery library entry ID when the SQL came from query_library_get. Attribution only; does not change execution or approvals.
formatNoText rendering: markdown or json. When omitted, uses the server's render setting.

Output​

RendererShape
KV{messages: [...], timestamp} - dispatch confirmation, not the API response body; plus rows when the statement returns results

From v1.1.975, a statement that returns rows, such as an INSERT ... RETURNING or a native IaC statement with RETURNING *, includes them as rows.


Native IaC statements​

With the server started with --preview '{"unstable":true}', this tool runs the native IaC statements: INSERT INTO and DELETE FROM stackql_preview.iac.run, INSERT INTO stackql_preview.iac.plan and UPDATE stackql_preview.iac.recover. They are gated by their SQL verb like any other mutation. When the server has the tasks extension enabled and the client declares it, a single INSERT or DELETE on stackql_preview.iac.run or INSERT on stackql_preview.iac.plan runs as a task that the client polls, after any approval; other calls are synchronous and subject to server.request_timeout. Each tool call is a fresh session, so a SET "$.document_merge" = ...; that a deployment needs must be in the same sql batch.


Example​

Try this prompt with any elicitation-capable MCP client with the StackQL MCP server registered:

The firewall rule allow-test-old in project my-project
is no longer needed. Please remove it.

The MCP client will surface an approval prompt before the delete is dispatched, unless the server is running in full_access mode.

The following clip shows the elicitation flow when the StackQL MCP server is running in the default safe mode - the client is prompted to approve the DELETE before any cloud-side change is dispatched. You can reproduce this against your own StackQL MCP server with the official MCP Inspector, started with npx @modelcontextprotocol/inspector: