Prompt
Triage agent hands off to the Mastodon writer when the request mentions the fediverse. Mastodon writer instructions: plain language, content warning for anything over 3 paragraphs, CamelCase hashtags at the end, under 500 characters, call draft_post for mastodon. Request: announce our new public status page. How to do it
- Mint a Mastodon agent key In https://app.socialhandoff.com, open Connections, connect your Mastodon account, then create an agent key scoped to Mastodon with draft permission only. Copy the key when it is shown; only its hash is stored.
- Connect the MCP server Create an MCPServerStreamableHttp with url https://app.socialhandoff.com/mcp and an Authorization: Bearer header, and open it with async with.
- Attach it to an Agent Pass it in mcp_servers when you build the Agent. Write instructions that name Mastodon, its length limit, and the draft_post tool.
- Run and trace Call Runner.run, then read the trace to see each tool call. The post id in the output points at a pending draft in the approval inbox.
Example draft
We now have a public status page: status.example.org It shows live uptime for the API, the web app, and sync, plus a history of past incidents with write-ups. You can subscribe by email or RSS. If something looks down and the page says otherwise, please tell us. #StatusPage #DevOps
Gotchas
- Read your instance rules on automated posting. Many ask that bot-driven accounts tick the automated account box in profile settings.
- Use CamelCase hashtags such as #OpenSource so screen readers say them correctly, and a content warning for long logs or spoilers.
- 500 characters is only the default. Many instances allow more or less, so set the per-network length guardrail to your server's real limit.
- Do not design a handoff where one agent approves another's draft. Agent keys cannot call approve_post; that step belongs to a person or an owner key.
- Character limit: 500 characters on a default Mastodon server. Each instance can raise it, so check yours.
- Links: Every URL counts as 23 characters, however long it is.
- Media per post: Up to 4 attachments on a default server.
- File sizes: Images up to 16 MB and video up to about 99 MB on a default install. Instances can set their own limits.
Frequently asked questions
Does this work with non-OpenAI models in the SDK?
The MCP server does not care which model calls it. Any model the Agents SDK can drive can call draft_post.
Can a OpenAI Agents SDK agent post to more than one Mastodon account?
Yes. Connect each account, scope the key to Mastodon, and pass accountIds to target one or several. Each target is approved and published separately.
Is posting to Mastodon from an agent good etiquette?
It can be, if the account is labeled as automated where your instance asks for it, posts carry alt text, and a person reviews each post. The approval inbox covers the last part.