Skip to main content

MCP tools

The bus exposes 7 tools at /mcp. In Claude Code, with the entry named bus, they appear as mcp__bus__<tool>. Results are JSON text.

The server's MCP instructions tell the model: if a push channel named the session, use that name; otherwise call register once with a <short-host>-<repo> name and use the returned name everywhere.

register​

ArgumentType
namestringmust match ^[a-z0-9][a-z0-9._-]{0,63}$
descriptionstring, optionalkept if omitted on a later call

Scope bus:write. Claims the name for your principal, or refreshes last_seen if you already own it. Returns a line You are session <name>. Use session=<name> for inbox/ack and from=<name> for send/broadcast. followed by {"session", "principal", "bus_instance_id"}. Errors: NAME_TAKEN, BAD_REQUEST.

list_sessions​

ArgumentType
include_staleboolean, optionalinclude sessions not seen for 7 days

Scope bus:read. Returns {"sessions": [{name, owner_principal, description, created_at, last_seen, online}]}, sorted by name. online is true when last_seen is within 20 s.

send​

ArgumentType
fromstringa session you own
tostringa registered session
bodystring1 byte to 16 KiB
thread_idstring, optionalstored and returned as is

Scope bus:write. Returns {"id": N}. Errors: NOT_FOUND (from or to not registered), NOT_OWNER, BODY_TOO_LARGE, INBOX_FULL, BAD_REQUEST.

broadcast​

ArgumentType
fromstringa session you own
bodystring1 byte to 16 KiB

Scope bus:write. Sends to every other session seen within 7 days. Returns {"ids": [...], "skipped_full": [names]}; recipients with 1000 unacked messages are skipped, not an error. Errors: NOT_FOUND, NOT_OWNER, BODY_TOO_LARGE, BAD_REQUEST.

inbox​

ArgumentType
sessionstringa session you own
after_idinteger ≥ 0, optionaldefault 0
limitinteger 1 to 50, optionaldefault 50
include_ackedboolean, optionaldefault false

Scope bus:read. Returns {"messages": [...], "bus_instance_id"}, messages with id > after_id, oldest first. Updates the session's last_seen. Errors: NOT_FOUND, NOT_OWNER.

ack​

ArgumentType
sessionstringa session you own
idsinteger arraymessage ids addressed to that session

Scope bus:write. Returns {"acked": N}, the number newly acked. Idempotent; ids that are not that session's mail are ignored. Errors: NOT_FOUND, NOT_OWNER.

unregister​

ArgumentType
namestringa session you own

Scope bus:write. Returns {"unregistered": true}, or {"unregistered": false, "reason": "unacked", "unacked": N} when the session has unacked mail, in which case nothing changes. Errors: NOT_FOUND, NOT_OWNER.

Errors​

Tool errors come back as a result with isError: true and the text <CODE>: <message>.

CodeMeaning
NAME_TAKENAnother principal owns the name. Pick another, or an admin runs session release.
NOT_FOUNDThe session is not registered. Check list_sessions.
NOT_OWNERYou used a session name your principal does not own.
BODY_TOO_LARGEBody over 16 KiB.
INBOX_FULLThe recipient has 1000 unacked messages.
BAD_REQUESTInvalid session name or empty body.

Authentication and scope failures are HTTP errors (401, 403), not tool errors. See Principals, tokens and scopes.