MCP use case: messaging

Send, broadcast and read chat messages from an AI agent

Twelve room and message tools let an assistant or your own agent create rooms, post, wait for a reply, broadcast to every room as a job, read and search the archive, and compute unread counts.

Wait up to 60s for a reply Broadcast as tracked jobs Search, context, unread counts
Ethora MCP server

In 30 seconds

Messaging over the Ethora MCP server works on rooms identified by a JID of the form appId_chatId, exactly what ethora-app-create-chat returns; every room tool also accepts the bare chatId once an app is selected. ethora-chats-message-v2 posts to one room and can wait for an agent’s answer; ethora-chats-broadcast-v2 enqueues a job that posts to many rooms; ethora-chats-history-v2, ethora-messages-search-v2 and ethora-messages-context-v2 read the archive; ethora-unread-counts-v2 reports unread messages per user and room.

Use this if

  • you want an assistant to seed, test or monitor conversations in its rooms
  • your automation must notify every room of an app at once and know which deliveries failed
  • you build notification or escalation logic on unread counts and search

Best for: operators testing agents in rooms, and server integrations that announce, audit or route on top of chat.

Step by step

1

Create or find the room

ethora-app-create-chat { title, pinned } creates a group room in an app you own and returns its JID; pinned: true makes new users auto-join. ethora-app-get-default-rooms lists the selected app’s rooms. ethora-app-delete-chat { chatJid } removes the room, its archive and all memberships; irreversible, and only registered when the dangerous-tools flag is on.

2

Post a message and wait for the agent

ethora-chats-message-v2 { text, roomJid, senderName, waitForReplySec } posts into one room in user auth, the hosted default. Set waitForReplySec up to 60 and the call holds until an AI agent in the room answers, returning it in replies.

3

Read the archive

ethora-chats-history-v2 { roomJid, limit, before } returns results newest last, each with from, nick, body and ts, plus a nextBefore cursor for older pages. It works in user or B2B auth, not app-token. A 502 MAM_READ_FAILED or mamUnavailable: true means the deployment has no message archive.

4

Broadcast to many rooms as a job

ethora-chats-broadcast-v2 { appId, text, allRooms | chatIds | chatNames } enqueues a job and returns a jobId; nothing is sent synchronously and the three targets are exclusive. It needs app-token or B2B mode with an explicit appId. ethora-chats-broadcast-job-v2 { jobId } reads the state once with per-room results; ethora-wait-broadcast-job-v2 { jobId, timeoutMs } blocks until a terminal state, under the same auth that enqueued it.

You: Tell every room in Ward Rounds that handover starts in 10 minutes and confirm delivery.

Assistant: ethora-chats-broadcast-v2 { appId, text, allRooms: true } ... jobId 7f3e.
ethora-wait-broadcast-job-v2 { appId, jobId: "7f3e", timeoutMs: 60000 } ... completed, 14 rooms, 0 failed.
5

Search messages and pull context

ethora-messages-search-v2 { q, chatId, fromUserId, since, until, sort, limit, offset } searches an app’s messages under B2B or tenant-actor auth. ethora-messages-context-v2 { chatId, aroundStanzaId | aroundMessageId, radius } returns the messages before and after a hit, so an agent can quote a thread rather than a lone line.

6

Unread counts for notification logic

ethora-unread-counts-v2 { userIds, mode, cap } returns per-room unread counts for a set of users in one batch: mode: count gives capped numbers, mode: flag booleans. It requires Mongo message archiving. Pair it with a broadcast to nudge only users who have not read the room.

The tools this uses

Names and descriptions come from the server’s own tool list. Read-only tools are safe to auto-approve; destructive ones make your client ask first. Full reference.

ToolNameWhat it doesAccess
Create Chat Roomethora-app-create-chatCreate a new chat room (MUC room) inside an app the caller owns.write
Delete Chat Roomethora-app-delete-chatPermanently delete a chat room from an app the caller owns - removes the MUC room, its message archive, and all member affiliations.destructive
Get Default Roomsethora-app-get-default-roomsList the default chat rooms (MUC rooms) of the currently selected Ethora app - every new user auto-joins these.read-only
Send Chat Messageethora-chats-message-v2Post a message into a chat room of an app (POST /v2/apps/:appId/chats/broadcast targeting one room).write
Get Chat Historyethora-chats-history-v2Read the archived messages of a chat room (GET /v2/apps/:appId/chats/:chatId/messages, newest last).read-only
Broadcast Messageethora-chats-broadcast-v2Enqueue an asynchronous broadcast job posting a message to one or more chat rooms of an app - returns a jobId; messages are not sent synchronously.write
Get Broadcast Jobethora-chats-broadcast-job-v2Fetch the current status and per-room results of a broadcast job by jobId (one-shot, no polling).read-only
Wait for Broadcast Jobethora-wait-broadcast-job-v2Block until a broadcast job reaches a terminal state (completed or failed) or until timeoutMs - read-only polling wrapper around ethora-chats-broadcast-job-v2.read-only
Search Messagesethora-messages-search-v2Search an App’s chat messages (GET /v2/apps/:appId/messages/search).read-only
Get Message Contextethora-messages-context-v2Fetch the messages surrounding a target message (GET /v2/apps/:appId/chats/:chatId/messages/context).read-only
Get Unread Countsethora-unread-counts-v2Batch per-room unread message counts for a set of users (POST /v2/apps/:appId/users/unread-counts).read-only

Announce, verify, then nudge the stragglers

“In the Ward Rounds app, post 'Handover starts in 10 minutes in room B' to every room, wait for the job and tell me which rooms failed. Then check whether users u_101, u_102 and u_103 have anything unread, and show me the last five messages in Night shift.”
  1. ethora-chats-broadcast-v2 { appId: "66f3d0e1f2a3b4c5d6e7f8a9", text: "Handover starts in 10 minutes in room B", allRooms: true }
  2. ethora-wait-broadcast-job-v2 { appId: "66f3d0e1f2a3b4c5d6e7f8a9", jobId: "7f3e2c1b", timeoutMs: 60000, intervalMs: 2000 }
  3. ethora-unread-counts-v2 { appId: "66f3d0e1f2a3b4c5d6e7f8a9", userIds: ["u_101", "u_102", "u_103"], mode: "flag" }
  4. ethora-chats-history-v2 { roomJid: "66f3d0e1f2a3b4c5d6e7f8a9_nightshift", limit: 5 }

One message delivered to every room with per-room results, a list of who still has unread messages, and the tail of Night shift.

Good to know

FAQ

How do I send a message over MCP?

Call ethora-chats-message-v2 with the text and the room JID or chat id. The message is posted as the app's broadcast sender, optionally under a senderName you choose. Add waitForReplySec, up to 60, and the same call returns an AI agent's answer in replies.

What is an MCP broadcast?

A tool call that posts one message to many chat rooms of an app at once. On Ethora it is asynchronous: ethora-chats-broadcast-v2 enqueues a job and returns a jobId, ethora-chats-broadcast-job-v2 reads its state and per-room results, and ethora-wait-broadcast-job-v2 blocks until it completes or fails.

Can I search chat history through the MCP server?

Yes. ethora-messages-search-v2 searches an app's messages by text, room, author and time window with sort, limit and offset, and ethora-messages-context-v2 returns the messages around a hit. Search uses B2B or tenant-actor auth, so it is a server-integration tool rather than a hosted user-session one.

Why does chat history return MAM_READ_FAILED?

The deployment has no message archive enabled, so there is nothing to read back. ethora-chats-history-v2 returns a 502 with MAM_READ_FAILED or a mamUnavailable flag in that case, and ethora-unread-counts-v2 needs the same Mongo message archiving. Self-hosted installs enable it in the deployment config.

Get started

Post a first message

Create a free account, get your connector URL under Account, AI Assistants, create a room and ask your assistant to say hello.

Free tier available Revocable API keys Self-host with the monoserver