curl example, choose your Cloud region. For authenticated calls, it must be the same region as your key. The examples below use MIROBODY_API_BASE:
This is not “Mirobody as an MCP server.” It’s the reverse: you bring external MCP tools into the agent’s reasoning. The platform executes the calls server-side — unlike client function tools, there is no handoff back to you.
Attach a server
Use the OpenAI Responses protocol’s owntools entry, on the Agent API:
Mix freely with your
type: "function" client tools in the same tools array. Limits: ≤ 8 servers per request, ≤ 64 tools total.
The response
MCP calls are server-side tool steps — they appear in the response’s top-leveltool_steps (name mcp__{label}__{tool}, with arguments and result) and stream as response.mirobody_tool_call events. The output array stays pure OpenAI item types; there is no function_call handoff for MCP tools.
Errors
In the web app
End users of Mirobody Chat, the consumer app on this same backend, can attach their own MCP servers under Settings → MCP, and its agent picks them up automatically each turn. That is the outbound direction, the same as this endpoint. (A self-hosted engine also serves the opposite direction: it mints a personal MCP URL so external clients can call into that instance; see MCP Integration.) A misconfigured or down server is skipped there (chat never fails because of it); on the API surface the same problem is an explicit400, because you asked for that server in this request.
When to prefer client function tools
If your tool needs to run inside your own process (private network, local state, human confirmation), use client function tools instead: the model hands off withfunction_call, you execute, and you resume the run — the openai-agents SDK automates that loop.
See also
- Function Calling — client tools, the other way to extend the agent.
- Agent API (Responses) — the endpoint that accepts the
toolsentry. - Streaming — how server-side tool steps appear in the stream.