# clear_site_chat

Source: https://modulify.ai/docs/mcp/chat/clear-site-chat

Clears the entire transcript of one chat of a site for everyone and throws away every message queued to run next in it. The chat stays open.

- Title: Clear a chat
- Scope: `sites:delete`
- Access: Destructive

It clears the chat whose `chatKey` is `main`, the one every site comes with, unless you pass `chatId`. A generation that is currently running in that chat is canceled first. The chat itself stays open, and a chat whose title was written for it, rather than given by somebody, is called `New chat` again until a later message names it. The site itself, its pages, its content and its code backups are untouched, and only the conversation goes. To close a chat altogether, use `archive_chat` instead.

It cannot be undone and there is no export, so read the history with `list_messages` first if any of it is worth keeping. The tool tells the client never to call it to tidy up or to start fresh on its own initiative, only when you have asked for exactly this.

Only the person who started the chat, or someone whose workspace role holds the **Delete projects** permission, may clear it. For the chat whose `chatKey` is `main`, only the **Delete projects** permission counts, and the built-in Member role does not hold it. Anyone else is refused with a `403` reading `Only the person who started this chat, or someone whose role can delete sites, can clear it!` A chat that does not exist or is closed, `main` included, answers `404` with `That chat was not found!` See [Clear a chat](https://modulify.ai/docs/build/multiple-chats#clear-a-chat).

On success the answer reads `Chat cleared successfully.` and carries `removed`, the number of messages cleared, and `cancelledJob`, true when a running generation was canceled.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `chatId` | string | No | The chat to clear: `main` for the chat every site comes with, or the `chatKey` of another chat from `list_chats`. Defaults to `main`. |