# create_chat

Source: https://modulify.ai/docs/mcp/chat/create-chat

Starts a new chat on a site and returns its chatId, or opens the chat every site comes with again when it is closed.

- Title: Start a new chat on a site
- Scope: `chat:write`
- Access: Makes changes

When the chat whose `chatKey` is `main`, the one every site comes with, is closed, this opens it again instead of starting another chat. That works on every plan, Free included: it comes back empty, called `New chat` unless you pass a `title`, keeps the mode it had, so `mode` is ignored, and the answer carries `chatId` `main`. See [Close a chat](https://modulify.ai/docs/build/multiple-chats#close-a-chat).

Otherwise multiple chats are a paid plan feature. A site on a paid plan can have up to 10 open chats, and up to 4 of them run at once, each in its own copy of the site, and their changes are merged into the site when each turn ends. See [Multiple chats](https://modulify.ai/docs/build/multiple-chats).

A new chat is called `New chat` until a message names it, unless you pass a `title`, and it starts in build mode unless you pass `mode`. Creating it spends nothing: send the first message with `send_message` and the `chatId` you get back. The response also carries the chat's summary in `chat`, in the same shape as an entry of `list_chats`.

## When it is refused

| Status | When | The message |
| --- | --- | --- |
| `403` | The workspace is on the Free plan and the site's chat is already open | `Multiple chats are part of the paid plans!` |
| `403` | The site already has the most open chats its plan allows, 10 on a paid plan | `This site already has the most chats your plan allows!` |
| `409` | The site's first build is still running | `Wait for the first build to finish before starting another chat!` |
| `409` | The site has not been built yet, for example because its first build was stopped or failed | `Send a message to build the site before starting another chat!` |
| `403` | The site is locked for going over the plan's site limit | `This project is locked because it goes over the plan's site limit, so chat cannot change it until the plan is upgraded!` |
| `400` | `title` is longer than 80 characters | `A chat title must be 1 to 80 characters!` |
| `409` | Another chat is being created on the same site at that moment | `Another chat is being created on this site. Try again in a moment!` |
| `409` | The site's `main` chat is closed and somebody is still closing it at that moment | `Wait for this chat to finish first!` |

The last two are safe to try again in a moment. When the call opens the site's closed `main` chat again, only a `title` that is too long and that last `409` can refuse it. When two calls open it at the same moment, both get `chatId` `main`.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id, from `list_sites` or `get_site`. |
| `title` | string | No | The title of the chat, at most 80 characters. Leave it out to have the chat named from its messages. |
| `mode` | string | No | `build`, where the agent makes the change, or `plan`, where it proposes a plan for you to approve first. Defaults to `build`, and is ignored when the call opens `main` again. |