convoyd is an MCP server. It serves the swarm tools at POST /v1/swarms/{name}/mcp, one MCP instance per active run, created lazily. Both agent SDKs attach it as a remote MCP server with the agent’s bearer token, so the tools are written once in Go and work for every SDK. The token identifies the caller; {me} below is the token’s agent.
Each tool handler calls the same Go function the REST handler calls, so there is one implementation per operation. Tool errors (the 422 and 409 bodies) are returned as MCP tool results with isError: true and the message text, which the SDKs show to the model. The model can correct and retry inside the same turn.
Tools
| Tool | Input | REST call | Who may call it |
|---|---|---|---|
list_topics | none | GET /topics | Every agent |
read_topic | topic: string, after?: integer, limit?: integer | GET /topics/{t}/messages | Every agent |
publish | topic: string, body: string, to?: string, reply_to?: integer | POST /topics/{t}/messages | Agents with the topic in writes |
watch_topic | topic: string | POST /agents/{me}/watches | Every agent, for itself |
create_topic | name: string, description: string | POST /topics | Every agent |
list_agents | none | GET /agents | Every agent |
create_agent | hcl: string | POST /agents | Agents with can_spawn, and the overseer when its can_spawn is true |
stop_agent | name: string, reason: string | POST /agents/{name}:stop | The creating parent; the overseer for its children or stuck agents |
report_progress | summary: string | POST /agents/{me}/progress | Every agent, for itself |
finish | output: object | POST /agents/{me}:finish | Every agent except the overseer |
note_progress | text: string | publish to progress | The overseer only |
All REST paths are under /v1/swarms/{name}. See HTTP API for every request and response.
list_topics()
Returns every topic with its description, writers, watchers, message count and the caller’s unread count. Agents also get this at the start of each turn.
read_topic(topic, after?, limit?)
Returns messages with seq greater than after, oldest first, at most limit (default 50, maximum 200). after defaults to the caller’s read cursor, so read_topic(t) returns the next unread page. The call advances the caller’s cursor to the highest seq returned. An explicit after below the cursor returns history without moving the cursor back. Errors: topic_not_found, with a suggestion.
publish(topic, body, to?, reply_to?)
Appends a message. The sender comes from the token. With to, the named agent also gets a turn and sees the message in full, whether or not it watches the topic. Every other watcher gets a turn after the debounce. Errors: not_writer (the topic is not in the caller’s writes), topic_not_found, body_too_large (over 64 KB), an unknown to or reply_to.
watch_topic(topic)
Adds the topic to the caller’s watches. Messages published to it after the call can give the agent a turn; the read cursor is unchanged.
create_topic(name, description)
Creates a topic and adds it to the caller’s writes. The name must match the identifier rule and be at most 64 characters. Errors: topic_limit (100 topics per run) and a name that already exists.
list_agents()
One row per agent: name, status, parent, whether declared, can_spawn, turns, spend, provider, model, a one-line role summary (the first non-empty line of the prompt, 100 characters), the last progress summary and timestamps. Sorted by name.
create_agent(hcl)
Adds one agent to the running swarm. hcl must contain exactly one agent block and nothing else. It is decoded against the run’s configuration, so provider.x and topic.x resolve. count and for_each are rejected. inputs and depends_on are allowed and resolve against existing instances. The caller becomes the parent, the child starts pending, and its depth is the caller’s plus one.
Checks, each a 409 unless noted:
| Code | Reason |
|---|---|
spawn_not_allowed | The caller’s can_spawn is false |
depth_limit | The child’s depth would exceed 3 |
tools_not_allowed | The child lists a tool its parent does not have |
model_not_allowed | The child’s provider or model differs from the parent’s and no declared agent uses it |
agent_exists | The name is taken |
| 422, with diagnostics | Not exactly one agent block, count or for_each used, or a reference does not resolve |
The overseer follows a different rule, because it has no tools: its child’s tools, provider and model must each appear on at least one declared agent. A child may declare can_spawn = true; it then follows the parent-subset rule for its own children. There is no limit on how many agents exist. --max-processes leaves extra agents pending, and spend is bounded by max_cost_usd. The tool is registered only for callers with can_spawn, but it is checked on every call, so hiding it is a convenience.
stop_agent(name, reason)
Stops the named agent, children first, depth-first. A runner may stop only agents it created; the overseer may stop its own children and any agent in stuck. Terminal states are idempotent. Error: not_parent.
report_progress(summary)
Records what is done and what is next, at most 4 KB. It resets the stuck timer and returns a stuck agent to running. The latest summary is what list_agents, convoy status and the overseer show for the agent.
finish(output)
Ends the agent with its output, at most 256 KB. The server checks the output against the agent’s declared output type. A mismatch is a 422 output_mismatch with the path of the bad field; the agent stays running and the model can try again. On success the agent becomes done, the controller evaluates done_when and the gates of dependent agents, and the next wake tells the runner to exit. The overseer is rejected with the overseer does not finish; the server ends the swarm, and the tool is not registered on its session.
note_progress(text)
Overseer only. Publishes to the built-in progress topic as overseer. It exists separately from publish so the overseer’s prompt can say “always end with note_progress” and the server can check it: if a turn ends without a note, the server publishes [overseer ended its turn without a note] on its behalf. It is not report_progress, which stores a summary on the agent’s own row.
Errors you will see
| Code | Status | From |
|---|---|---|
not_writer | 403 | publish |
topic_not_found | 404 | read_topic, publish |
body_too_large | 413 | publish |
topic_limit | 409 | create_topic |
spawn_not_allowed, depth_limit, tools_not_allowed, model_not_allowed, agent_exists | 409 | create_agent |
not_parent | 403 | stop_agent |
output_mismatch | 422 | finish |
overseer_cannot_finish | 403 | finish |
run_ended | 409 | any write after the run is terminal |
Tool names in each SDK
In the Claude Agent SDK the tools are named mcp__convoy__<tool>. In the OpenAI Agents SDK they appear under the MCP server named convoy. SDK built-in tools such as bash and web_search are separate and come from the agent’s tools list; see Runner.