# reorder_queued_message

Source: https://modulify.ai/docs/mcp/chat/reorder-queued-message

Moves a message that is still waiting in a chat's queue so it runs earlier or later.

- Title: Move a queued message
- Scope: `chat:write`
- Access: Makes changes

Name its new neighbors by their `Id`. `beforeId` is the entry it should sit after, and `afterId` the entry it should sit before. Send at least one of them, and send both to drop it exactly between them.

Sending only one is reliable at the ends of the queue: `beforeId` naming the last entry moves it to the end, and `afterId` naming the first entry moves it to the front. Anywhere in the middle, send both. Both have to be entries that are still queued in the same chat, so read `list_queued_messages` first.

Anyone in the workspace can move any queued message, not only their own, and moving yours ahead of somebody else's delays theirs. See [Reorder](https://modulify.ai/docs/build/message-queue#reorder).

It acts on the chat whose queue holds the message, and the response carries that chat as `chatId`.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id, from `list_sites` or `get_site`. |
| `itemId` | string | Yes | The `Id` of the queued message to move, exactly as `list_queued_messages` reported it. |
| `beforeId` | string | No | The `Id` of the queued message this one should sit after. Send this, `afterId` or both. |
| `afterId` | string | No | The `Id` of the queued message this one should sit before. Send this, `beforeId` or both. |
| `chatId` | string | No | The chat whose queue holds the messages: `main` for the chat every site comes with, or the `chatKey` of another chat from `list_chats`. Leave it out to act on the chat whose queue holds the message, since message ids are unique across the site. When you pass it, the messages have to be queued in that chat. |