Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Mail

Endpoint /mail (or mail_<tool> under /mcp). The mail service reads and organises your iCloud mail over IMAP and saves drafts; it sends mail over SMTP only when you allow it.

Tools

ToolKindWhat it doesKey parameters
list_mailboxesreadMailboxes with their role (Inbox, Sent, Drafts, Trash, Junk, Archive), total and unread countsnone
search_messagesreadSearch one mailbox, newest first; every filter is optional and they combine with AND. Returns summaries, the mailbox uidvalidity and next_cursormailbox (default INBOX), from, to, subject, text, since, before (YYYY-MM-DD), unseen, flagged, limit (1 to 100, default 25), cursor
get_messagereadHeaders, body and attachment list of one message. Does not mark it as readmailbox (default INBOX), uid, format (text, html or raw), max_chars (default 20000)
get_attachmentreadOne attachment as an embedded base64 resource, up to MAX_ATTACHMENT_BYTESmailbox (default INBOX), uid, index (from get_message)
get_threadreadThe conversation a message belongs to, linked by Message-ID, References and In-Reply-To, from its mailbox and Sent, ordered by datemailbox (default INBOX), uid
mark_messageswriteMark as read or unread, flagged or unflaggedmailbox (default INBOX), uids (1 to 100), seen, flagged, uidvalidity
move_messageswriteMove messages to another mailboxmailbox (default INBOX), uids, target_mailbox, uidvalidity
delete_messageswriteMove messages to Trash; with permanent: true, messages already in Trash are removed for goodmailbox (default INBOX), uids, permanent, uidvalidity
create_mailboxwriteCreate a mailbox (folder)name
rename_mailboxwriteRename a mailbox; its child mailboxes move with it. Refuses INBOX and system mailboxes (Sent, Drafts, Trash, Junk, Archive), and a new name that already exists or is a system mailbox namename, new_name
delete_mailboxwriteDelete an empty mailbox for good. Refuses INBOX, system mailboxes, and mailboxes that hold messages or child mailboxesname
create_draftwriteSave a new draft in Drafts, optionally with attachments. Nothing is sentto, cc, bcc (name@example.com or Name <name@example.com>), subject, body_text, body_html, attachments (each filename, content_type, content_base64; at most 10, decoded total up to MAX_ATTACHMENT_BYTES)
create_reply_draftwriteSave a threaded reply draft with the original quoted, optionally with attachments. Nothing is sentmailbox (default INBOX), uid, body_text, reply_all, attachments (each filename, content_type, content_base64; at most 10, decoded total up to MAX_ATTACHMENT_BYTES)
create_forward_draftwriteSave a forward draft, optionally with the original attachments. Nothing is sentmailbox (default INBOX), uid, to, body_text, include_attachments (default true)
send_draftwriteSend a draft over iCloud SMTP, save a copy to Sent and remove the draft. Registered only with ICLOUD_ALLOW_SEND=trueuid (in Drafts), uidvalidity

Prompts

Prompts are ready-made requests a client can offer you. They tell the model which tools to call and in what order; they change nothing by themselves.

PromptArgumentsWhat it does
triage_inboxmailbox (default INBOX), limit (1 to 100, default 25)Summarises the unread messages and suggests replying, flagging, moving or deleting each one. Acts only on what you approve, writes reply drafts only when you ask, and never sends

Arguments are text; a blank argument takes its default, and an invalid one (a limit outside 1 to 100) is refused. If a step needs a tool this server does not offer (a read-only service), the model is told to say so and skip it.

Addressing messages

Messages are addressed by mailbox plus UID. Listings also return the mailbox uidvalidity; pass it back to the changing tools. If the mailbox was rebuilt in the meantime (its uidvalidity changed), the tool refuses instead of touching a different message that now has the same UID.

Sending

  • Without ICLOUD_ALLOW_SEND=true, send_draft is not registered: clients do not see it, and the other tools can only save drafts.
  • send_draft only sends messages flagged as drafts in the Drafts mailbox, and sends one message at a time.
  • ICLOUD_FROM_NAME sets the display name on drafts; the address is always ICLOUD_EMAIL.
  • create_draft and create_reply_draft take attachments as {filename, content_type, content_base64} objects: filename 1 to 255 characters without /, \ or control characters, content_type a plain type/subtype such as application/pdf, content_base64 standard base64. If any attachment is invalid or the decoded total is over MAX_ATTACHMENT_BYTES, nothing is saved. The result lists each attachment’s filename, content_type and size.

iCloud notes

  • When the server supports IMAP MOVE it is used; otherwise moves use COPY, then flag and expunge only the moved UIDs (UIDPLUS), so other deleted messages in the mailbox are never expunged.
  • Message bodies are cached in memory (CACHE_MAX_BYTES), so reading the same message twice does not download it again.
  • Idle IMAP connections are closed after IMAP_IDLE_TIMEOUT seconds and reopened on demand.