Function Calling Email Sends
When an AI agent can call functions, sending email stops being a manual handoff and becomes another tool in the loop. marginal exposes email sends, A/B tests, and results as MCP tools your model can call directly — so an agent can draft variants, launch a test, and read lift metrics without leaving the conversation.
What function calling email sends actually means
Modern LLMs decide when to invoke a tool and with what arguments — that's function calling. The Model Context Protocol standardizes how those tools are described and reached, so any compatible client can discover them. marginal is a hosted email MCP server that publishes the send and test functions an agent needs.
Instead of writing glue code around an ESP, you point your agent at https://marginal.sh/mcp and let it call functions like a developer would call an SDK method — but driven by the model's reasoning about your campaign goal.
- generate_variants — produce candidate subject lines for a message
- launch_test — start a managed send and subject line A/B test
- get_results — pull open/click tracking and within-test lift
- recommend_next — decide the follow-up send based on outcomes
A typical agent loop
Because each step is a callable function, the agent can chain them. A subject line A/B test goes from idea to live send in a single back-and-forth, and the model uses returned metrics to choose what to do next rather than guessing.
- Ask the agent to write variants → it calls generate_variants
- Approve a split → it calls launch_test against your audience
- Wait for engagement → it calls get_results for lift by variant
- Scale the winner → it calls recommend_next for the rollout send
Why a hosted MCP server fits AI agent email marketing
marginal runs the send infrastructure and tracking for you — there is no self-hosted MCP server to operate and no provisioning of mail pipelines on your side. You authenticate with a Bearer API key (marg_live_...) and the tools are immediately available to your agent.
That keeps AI agent email marketing reproducible: the same function calls behave the same way across runs, and tracking is consistent so the lift numbers an agent reads are trustworthy.
- Managed sends with open and click tracking built in
- Within-test lift metrics so the agent compares variants fairly
- Free tier of 100 experiments/month to prototype loops
- Works in Cursor, Claude Desktop, Claude Code, Windsurf, Cline, Continue, Codex, and Zed
Getting started
Connect any MCP-capable client to the marginal endpoint, add your key, and prompt the agent with a campaign goal. From there function calling email sends are just part of the model's plan — it generates variants, launches the test, and reports results.
- Endpoint: https://marginal.sh/mcp
- Auth: Bearer API key (marg_live_...)
- Docs and tool schemas: https://marginal.sh/docs/
Get started with marginal
marginal is a hosted email marketing MCP server at marginal.sh. Sign up free, create an API key, and connect https://marginal.sh/mcp from Cursor, Codex, or Claude Desktop.
- 100 experiments/month on the free tier
- Four MCP tools: generate_variants, launch_test, get_results, recommend_next
- Listed in the MCP Registry as sh.marginal/mcp