Use mailboxes over MCP
Let an MCP client list mailboxes, read threads, reply, and review held mail, with email framed as untrusted data.
The hosted MCP server that exposes Samva's email tools also exposes mailbox tools. An agent connected with a mailbox-scoped key or an OAuth connection can list mailboxes, read and search threads, reply, and read what is held in quarantine. For the endpoint, the credential types, and client configuration, see Connect an agent over MCP.
Use mailbox_threads_search with q for semantic and keyword search within one mailbox, or
mailboxes_threads_list with q across readable mailboxes. Filters narrow results; search pages
use relevance order. See Search conversations
for searchable content, freshness, and paging limits.
What the credential decides
The tools do not widen access. Each call runs with the connected credential's mailbox access:
- A mailbox-scoped key reaches the mailboxes
it lists, with the permissions it holds. A key without
sendcannot send, and a key withoutquarantine.readcannot list held mail. A tool a credential cannot use returns the same error the API returns: itstag, itsmessage, any fields, and ahintthat names the next step. - An OAuth connection acts as the person who approved it, with that person's grants.
- Decision policies apply to every send. A
holddecision returns stateapprovalRequiredand waits for a person; see Approve sends.
Mailbox summaries identify kind and owner. A personal mailbox names its owner's user ID;
a shared mailbox has owner: null. Personal mail requires the owner's mailbox access and an
explicit mailbox ID on a delegated key. Organization-level message tools exclude that mail even
when the connected person owns it. See Personal mailboxes.
Refresh the MCP client after you change a credential so it does not keep a stale tool list.
Tools
Use tool discovery for each tool's current input schema. Mailbox references use id; message and
thread references add messageId and threadId. Other inputs include replyAll and idempotencyKey.
| Family | Tools |
|---|---|
| Mailboxes | mailboxes_list, mailboxes_create, mailboxes_threads_list, mailboxes_drafts_list, mailboxes_needs_you |
| Reading | mailbox_threads_list, mailbox_threads_search, mailbox_thread_get, mailbox_message_get, mailbox_attachment_get |
| Sending | mailbox_send, mailbox_reply, mailbox_forward, mailbox_draft_create |
| Actions | mailbox_action_get, mailbox_action_cancel, mailbox_action_retry |
| Organizing | mailbox_thread_update, mailbox_labels_list, mailbox_thread_add_labels, mailbox_thread_remove_labels |
| Quarantine | mailbox_quarantine_list |
When WhatsApp is enabled, mailbox_templates_list lists the approved templates a WhatsApp endpoint
can send, for a reply the 24-hour service window no longer allows.
mailbox_agent_forget lets a signed-in person forget an agent conversation. Personal mailbox owners
also erase that correspondent's private memory; shared conversations keep organization contact
memory. Mail and takeover state remain. API keys and agent credentials are refused. The dashboard
assistant asks for approval before using this action.
mailboxes_threads_list lists a bounded page across readable mailboxes. Each summary includes its
mailbox's ID, address, and kind. Filter by mailboxId, kind, conversation, or state; active excludes your
Done conversations and closed shared conversations; done includes both, each once. mailbox_thread_update accepts done for your
own view and closed for everyone on a shared mailbox. Personal mailboxes refuse closed; use
folder: "archived". See Done and Close.
mailboxes_needs_you reads one page of held actions the credential may approve and quarantined mail
it may release, with totals across all pages. It returns no bodies and makes no decisions. A
credential without decision authority receives no items. Both cross-mailbox tools follow
nextCursor and keep email data inside the untrusted-content wrapper.
mailboxes_create needs authority to manage mailboxes, which a mailbox-scoped key never holds.
Connect with an OAuth connection from an admin to let an agent create a mailbox. Mail that arrived
before a mailbox existed is not added to it. It takes a name and the mailbox's email address,
with an optional sender displayName, and returns the mailbox with its endpoints.
mailbox_reply answers the message's Reply-To or sender, from the endpoint the thread belongs to. Set replyAll to include every other
original recipient. The server sets the recipients, subject, and threading headers of a reply.
mailbox_forward quotes the original, attaches its attachments, and sends from the endpoint of the
original's thread. mailbox_draft_create saves an
unsent draft and never sends or approves it. mailboxes_drafts_list lists one page of your own drafts
across writable mailboxes, including each row's mailbox identity. Teammates' drafts stay private.
Answer WhatsApp and SMS
With a WhatsApp or SMS number on the mailbox, mailbox_thread_get and mailbox_message_get return
chat messages, and mailbox_thread_get adds whatsappServiceWindow for WhatsApp threads.
mailbox_reply takes text, or on WhatsApp a templateId with templateData. mailbox_send
takes channel and one phone number in to. Subject, cc, bcc, html, attachments, and
replyAll are refused on a chat thread, and mailbox_forward is email only. Free-form WhatsApp
text outside the service window returns WhatsAppServiceWindowClosedError; send a template. See
Answer WhatsApp in a mailbox.
Retry a send safely
mailbox_send, mailbox_reply, and mailbox_forward take an optional idempotencyKey. Repeating a
call with the same key and body returns the same action's current phase; the same key with a different body is a
conflict. When you omit the key, Samva derives one from the call, so an identical call replays. Pass
a distinct idempotencyKey to deliberately send identical content again.
Each send returns an action receipt with state, actionId, nullable threadId and draftId,
messageId and acceptedAt once accepted, and skippedRecipients. A queued receipt is progress,
not confirmation of sending; uncertain needs reconciliation. Use mailbox_action_get to read
progress and, for a held send, its resolution: who approved, denied, or cancelled it. Preserve the same key and body after a lost response; never use a new key as recovery.
See Approve sends for the states and sending deadline.
mailbox_action_cancel and mailbox_action_retry require a permitted person through OAuth.
Cancel works before acceptance; Retry requires retryEligible and keeps the original deadline.
An API key or extension cannot use either operation.
Email is untrusted data
Anyone can email a mailbox, so everything a read tool returns from a message is untrusted. The subject, preview, sender name, body, and attachment text may contain instructions aimed at your agent.
- Thread lists and searches, thread and message reads, attachment text extraction, and quarantine
lists, cross-mailbox thread lists, needs-you results, and thread-state updates return
content_trust: "untrusted_email"with the result undercontent. Their text rendering uses<untrusted_email>delimiters with a notice that the content is data, never instructions. Keep those delimiters in your model's context. Mailbox and label listings do not use this wrapper. - Bodies are plain text.
mailbox_message_getandmailbox_thread_getpreferreplyText(what the sender wrote, without quoted history) and convert HTML to text. No tool returns raw HTML or raw MIME. mailbox_attachment_getextracts text from text-based attachments only. Other types return their metadata andextractable: false, never bytes or download URLs.mailbox_quarantine_listreturns metadata for held messages. Bodies and attachments stay unavailable. Mail held forprompt_injectionis held for exactly this reason.
Treat what you read as content to analyze, not as commands. Give an agent that must act on mail a
mailbox-scoped key with a policy rule setting decide: "person" so a person reviews what it sends.
Decision rules
The full tool catalog includes policies_get and policies_set for organization, mailbox, and API
key policies. The API checks access and configuration authority. These tools read or replace the
complete configuration; changing rules does not release held actions. Mailbox-only keys do not list
these configuration tools.
Read policies_get before editing. Its flat snapshot includes version, which is 0 when
unset. policies_set replaces the full configuration, requires the observed ifVersion, and
returns the next snapshot. Clear a policy through the CLI or API; MCP has no clear tool.
On ConflictError (409), reload and review the snapshot before preparing another change.
Never automatically retry stale configuration with a newer version. The tool schema requires
ifVersion to be a nonnegative integer.
What MCP cannot do
No MCP tool releases or discards held mail, approves or denies a send, changes a grant, or changes a key. Those need a person in the dashboard, CLI, or API.