# discard_chat_changes

Source: https://modulify.ai/docs/mcp/chat/discard-chat-changes

Throws away the unmerged changes of a chat, keeping everything it already merged into the site.

- Title: Discard the unmerged changes of a chat
- Scope: `sites:delete`
- Access: Destructive

It removes the changes from the chat that could not be merged into the site automatically, which `list_chats` shows as `pending`, and anything its copy of the site still holds. Changes that were already merged stay on the site. Multiple chats are a paid plan feature. See [Changes not merged](https://modulify.ai/docs/build/multiple-chats#changes-not-merged).

It cannot be undone, so the tool tells the client to try `merge_chat_changes` first and to confirm with you before discarding. For the same reason it needs the `sites:delete` scope, which is not ticked when you create a token, and `chatId` has no default: the client has to name the chat, `main` included.

## When it is refused

| Status | When | The message |
| --- | --- | --- |
| `409` | A generation runs in that chat, or its changes are already being merged or discarded | `Wait for this chat to finish first!` |
| `409` | The site does not work with several chats yet, so nothing is kept unmerged | `This chat has no unmerged changes!` |
| `503` | The site could not be reached to throw the changes away | `The site could not be reached to finish this. Try again in a moment!` |

The `503` is safe to try again in a moment.

## Who can discard

Discarding needs the same permission as closing a chat. Only the person who started the chat, or someone whose workspace role holds the **Delete projects** permission, may discard its changes, and anyone else is refused with a `403` reading `Only the person who started this chat, or someone whose role can delete sites, can discard its unmerged changes!` For `main`, the chat every site comes with, only someone with **Delete projects** may, and anyone else is refused with a `403` reading `Only someone whose role can delete sites can discard the unmerged changes of this chat!` See [Members and roles](https://modulify.ai/docs/reference/members-and-roles#every-permission).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id, from `list_sites` or `get_site`. |
| `chatId` | string | Yes | The chat whose unmerged changes to discard: `main` for the chat every site comes with, or the `chatKey` of another chat from `list_chats`. There is no default. |