# run_mutation_query

> MCP tool executing INSERT, UPDATE, REPLACE, or DELETE against a provider via StackQL

Source: https://stackql.io/mcp/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](/command-line-usage/mcp#server-modes):

| Mode | `INSERT` / `UPDATE` / `REPLACE` | `DELETE` |
|--|--|--|
|`read_only`|refused|refused|
|`safe` (default)|needs approval (elicitation)|needs approval|
|`delete_safe`|allowed|needs approval|
|`full_access`|allowed|allowed|

:::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 ]](/command-line-usage/mcp) [[ `run_lifecycle_operation` ]](/mcp/run_lifecycle_operation) [[ `describe_method` ]](/mcp/describe_method) [[ INSERT language spec ]](/language-spec/insert) [[ DELETE language spec ]](/language-spec/delete)

* * *

## Inputs

| Argument | Required | Description |
|--|--|--|
|`sql`|Yes|An `INSERT`, `UPDATE`, `REPLACE`, or `DELETE` statement.|

* * *

## Output

| Renderer | Shape |
|--|--|
| KV | `{messages: [...], timestamp}` -- dispatch confirmation, not the API response body |

* * *

## 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 using the official [MCP Inspector](https://github.com/modelcontextprotocol/inspector) using `npx @modelcontextprotocol/inspector`:
