Email Template Tools¶
The MCP Server ships with a four-tool family that lets the AI draft, preview, send a test of, and stage a mass mailing from Odoo email templates. The split into four tools is intentional: each step is a separate consent boundary, so admins can grant draft authority without granting outbound-mail authority.
The four tools¶
create_email_template¶
Creates a new mail.template and auto-renders a preview
against a sample record. The AI must specify:
name— display name (unique per template).subject— with Jinja-style placeholders allowed (e.g.Following up on quote {{ object.name }}).body_html— polished, email-safe HTML.send_mode— eitherindividual(one customer at a time, full styling allowed) ormass(many customers at once, Outlook-safe styling required).The data source — either
model(a technical Odoo model name) orconcept(a Business Concept from the Ontology Layer).
The AI is trained to ask the user which send mode before drafting, because the HTML skeletons are different:
Individual — allows gradients, styled CTA buttons, border-radius. Sent via the
mail.templatefrom chatter / send-test / server actions.Mass — strips gradients and styled-anchor buttons via Odoo’s Email Marketing sanitiser. The AI emits a bulletproof table-based skeleton instead.
Category: write. Risk: medium.
Duplicate-name handling¶
If a template with the same name already exists, the call
returns an error with status duplicate_name plus the
existing template’s ID and edit URL. The AI will then ask
the user one of three things:
Use the existing template as is.
Replace in place (preserves the ID so mass mailings stay wired).
Rename the new draft (e.g. Welcome Email (v2)).
The AI never silently overwrites.
preview_email_template¶
Re-renders an existing template against a sample (or chosen) record. Pure read — no DB writes, no SMTP, safe to call repeatedly. Used after the user edits the template in Odoo.
Category: read. Risk: low.
send_test_email_template¶
Sends one real test email. By default the test goes to the current user’s email — the person asking — not the recipient implied by the template. So even if the AI gets something wrong, no real customer is emailed.
The AI is required to confirm with the user before calling this tool (“Want me to send a test to your email?”); never auto-fire after a create.
Category: execute. Risk: high.
stage_mass_mailing_from_template¶
Creates a mailing.mailing (Mass Mailing) record in
draft state from an existing template. Critically, this
tool never fires the actual blast — the user must open
the staged mailing in Odoo and click Send.
If the Mass Mailing module isn’t installed, the tool returns
status="needs_module" with an install URL so the AI can
prompt the user to set it up first.
Category: write. Risk: medium.
Safety summary¶
Tool |
Risk |
Default approval |
|---|---|---|
|
Med. |
Optional |
|
Low |
No |
|
High |
Recommended |
|
Med. |
Recommended |
Tip
For marketing connections, leave draft tools wide
open but require approval on send_test_email_template
and stage_mass_mailing_from_template. The team can
ideate freely without ever surprising a real recipient.