Automations
automationCreate and manage unattended email triage rules that run on a schedule, applying actions like move, label, mark read, forward, or draft reply based on search filters. Preview before enabling.
Instructions
Create and manage unattended scheduled triage rules. A rule is a stored search plus one fixed action, evaluated on a cadence with NO model in the loop: mail is matched, never interpreted. Set action: 'create' (name, filter, rule_action, interval_minutes; the rule is created DISABLED), 'list', 'get' (automation_id), 'update' (automation_id + fields), 'enable'/'disable' (automation_id), 'delete' (automation_id; run history is kept), 'runs' (automation_id, recent run counters), or 'preview' (DRY RUN: reports what a filter matches right now and applies nothing). NOTE the two different keys: action selects the operation on this tool, while rule_action is the action the RULE performs on matching mail. Rule actions are move, label (applied as a Gmail label, an Outlook category or an IMAP keyword), mark_read, forward and draft_reply. DELETING MAIL IS NOT AVAILABLE to an automation. A forward is ALWAYS held for human approval whatever the inbox's approval setting says, and a draft_reply only ever writes a draft. Always 'preview' before you 'enable'. Every action needs manage:automations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Human-readable name for the rule. | |
| inbox | No | Inbox email address; an alternative to inbox_id, which wins when both are given. | |
| limit | No | How many runs to return, newest first. | |
| action | Yes | Operation to run. | |
| filter | No | The stored search, as the same structured criteria email_search takes: from, to, cc, subject, body, text, unread, has_attachment, flagged, since, before. At least one criterion is required - an empty filter matches the whole mailbox. Provider-native 'raw' queries are NOT accepted here: a rule re-executes unattended for months, and a raw string is a dialect nothing validates. | |
| inbox_id | No | Inbox UUID. Optional when the key has exactly one inbox. Otherwise pass this or `inbox`; omit both and the error lists every inbox_id. | |
| rule_action | No | One tagged action. {type:'move',folder} | {type:'label',label} (applied as a Gmail label, an Outlook category, or an IMAP keyword; on IMAP a label is an atom, so spaces become underscores and ( ) [ ] { } % * " \ are refused) | {type:'mark_read'} | {type:'forward',to:[...],note} | {type:'draft_reply',template}. DELETING MAIL IS NOT AVAILABLE to an automation and is refused. 'forward' is ALWAYS held for human approval regardless of the inbox's approval setting, and 'draft_reply' only ever creates a draft. A draft_reply template substitutes {{sender_name}}, {{sender_email}}, {{subject}} and {{date}} and nothing else; everything else is literal text and message bodies are never interpolated. | |
| automation_id | No | The automation's UUID, as returned by action 'list' or 'create'. | |
| interval_minutes | No | Minutes between runs. A fixed ladder, not a free integer: a 1-minute rule hammers a provider into rate limiting. | |
| max_messages_per_run | No | Per-run blast radius. Caps how much mail one misconfigured filter can touch before a human sees the run log. |