Create mail rule
create_mail_ruleSet up a persistent mail rule that automatically sorts, labels, archives, or forwards future incoming messages until disabled or deleted; use it for ongoing filtering, not one-time cleanup.
Instructions
Create a persistent mail rule (filter) that automatically sorts, labels, archives or forwards FUTURE incoming messages until it is disabled or deleted. Use ONLY when the user expresses ongoing behavior — "automatically…", "from now on…", "whenever I receive…". If a request is ambiguous between a one-time cleanup and a standing rule (e.g. "archive all GitHub notifications"), ask which they mean first. Rules run server-side on arrival; every rule whose conditions match runs. Existing mail is untouched unless you pass existingMail (preview_mail_rule first — large backfills need explicit confirmation). Returns the created rule with its id.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"actions": "<actions>",
"conditions": "<conditions>"
},
"name": "create_mail_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional human-readable rule name, e.g. "Archive GitHub Notifications". | |
| match | No | How multiple conditions combine: "all" = every condition must match (AND), "any" = one is enough (OR). | all |
| actions | Yes | What happens to a matching message — one or more actions, applied in order. | |
| conditions | Yes | When the rule fires; at least one is required. Matching is case-insensitive substring matching. | |
| existingMail | No | Optionally also apply the actions to mail already in the mailbox. Omit (or mode "none") to affect future mail only — the safe default unless the user asked for a cleanup too. |