Skip to main content

MCP tools

Every tool below is available at POST /api/mcp once a client is connected. "Scope" is the API-key scope the call requires; tools marked none need a valid key but no particular scope.

Campaigns​

A campaign is a one-time send to a list, segment, tag, or set of named addresses.

ToolScopeWhat it does
list_campaignscampaigns:writeThe project's campaigns, newest first, with delivery and engagement counters.
get_campaigncampaigns:writeOne campaign by id, including per-arm stats for an A/B send.
count_audiencecampaigns:writeHow many contacts an audience would actually reach. Read-only.
create_campaigncampaigns:writeCreate and immediately enqueue a campaign.
save_campaign_draftcampaigns:writeCreate a campaign as a draft. Sends nothing.
update_campaign_draftcampaigns:writeEdit a draft, or a scheduled campaign that has not started sending.
launch_campaigncampaigns:writeEnqueue a saved draft. Sends email.
render_campaign_previewcampaigns:writeRender a campaign's real content and subject. Read-only.
cancel_campaigncampaigns:writeHalt a campaign's still-pending sends. Idempotent.

The reviewable workflow​

create_campaign enqueues the moment it returns. Unless a scheduleAt is set, mail starts going out immediately and there is no state in between where a human could look at it. That is rarely what you want from an agent.

Prefer this instead:

  1. count_audience — confirm the audience is the size you expected. Sends nothing, so this is always safe to call first.
  2. save_campaign_draft — persist the campaign as a draft. Still sends nothing; it now appears in the console where a person can open it.
  3. render_campaign_preview — see the actual subject and rendered body, resolved through the same path the dispatcher uses.
  4. update_campaign_draft — fix anything that looks wrong, as many times as needed.
  5. launch_campaign — send it, once a human has approved.

Steps 1–4 are all reversible. Only step 5 is not.

Editing rules​

update_campaign_draft replaces a campaign's settings rather than patching them: an optional field you omit is cleared. Call get_campaign first if you only mean to change one thing. Omitting data is the single exception — that leaves the campaign's pinned content untouched.

Editing a scheduled campaign returns it to a draft and drops its pending sends; the result carries reverted: true to say so. Call launch_campaign again to re-arm it.

A campaign that has started sending cannot be edited. update_campaign_draft refuses with reason: "not_editable", and a scheduled campaign within a minute of its send time refuses with reason: "too_close_to_send" rather than risk racing the dispatcher.

Templates — design​

Templates are stored as an EmailDocument tree. The model authors the document; these tools are the ground truth it checks itself against.

ToolScopeWhat it does
get_document_schemanoneThe EmailDocument JSON Schema.
validate_documentnoneValidate a document, with per-path errors.
render_previewnoneRender a document to HTML without saving it.
import_html_to_documentnoneBest-effort conversion of existing HTML into a document tree.
get_template_documentnoneThe stored document for a template key.
save_template_documenttemplates:writePersist a document, optionally publishing it.
send_test_emailsendSend a rendered document to one address.

The usual loop: import_html_to_document → refine → validate_document until it passes → render_preview to inspect → save_template_document.

Templates — management​

ToolScopeWhat it does
list_templatesnoneTemplate keys, types, and enablement for a brand.
set_template_enabledtemplates:writeEnable or disable a template, and set its default sender.
rename_templatetemplates:writeChange a template's display name.

Contacts​

ToolScopeWhat it does
list_contactscontacts:readFilter by status, tag, or free-text query.
get_contactcontacts:readOne contact by id or email.
upsert_contactscontacts:writeCreate or update names and profile fields for up to 500 contacts, idempotent on email.
unsubscribe_contactcontacts:writeUnsubscribe one contact.

Sequences​

ToolScopeWhat it does
describe_sequence_nodessequences:writeThe authoring contract: every node kind's config and out-ports, which triggers fire, the condition language.
list_sequencessequences:writeSequences, optionally filtered by status.
create_sequence_draftsequences:writeAn empty draft with the minimal trigger → exit graph, ready for update_sequence.
create_sequencesequences:writeCreate a sequence from an ordered list of steps.
get_sequencesequences:writeA sequence as a portable flow graph.
update_sequencesequences:writeReplace a sequence's graph atomically.
simulate_sequencesequences:writeDry-run a contact through a sequence. Nothing is sent or persisted.
set_sequence_statussequences:writeFlip a sequence between draft, active, paused, and archived.
enroll_contactsequences:writeEnroll one contact in a named sequence.
enroll_by_triggersequences:writeEnroll a contact into whatever sequence a trigger arms.
bulk_enrollsequences:writeEnroll up to 5000 contacts at once.
record_eventsequences:writeRecord a product event, which may enroll or exit sequences.

Authoring a flow​

A sequence is a graph, not a list, and a graph that saves cleanly can still enroll nobody — a split whose variants have no edges, or a trigger kind the engine never reads. So start with describe_sequence_nodes (or the mailroom://schema/sequence-nodes resource), then:

create_sequence_draft → a draft enrolls nobody, so it is safe to iterate on
update_sequence → send the whole graph; it replaces what is stored
simulate_sequence → endedBy "dead_end" means a port has no edge
set_sequence_status → "active" is what finally makes it live

simulate_sequence is the sequence equivalent of count_audience — use it to see where a contact would end up before enrolling anyone for real.

Only event triggers are evaluated. segment_enter, segment_exit, schedule and manual are accepted and stored, and nothing ever reads them.

Resources​

URIWhat it is
mailroom://schema/email-documentJSON Schema for the EmailDocument tree
mailroom://schema/sequence-nodesthe flow-graph authoring contract, in markdown
mailroom://templates/registrythe project's template keys, types, and default subjects
mailroom://examples/seedspreset documents to use as references
mailroom://brand/themethe resolved brand render theme