manage_gmail_filter
Create or delete Gmail filters using customizable criteria and actions. Automate email organization by labeling, forwarding, or archiving messages.
Instructions
Create or delete a server-side Gmail filter.
Side effects: creates a persistent auto-action rule or permanently deletes one. Filter updates are not supported by the Gmail API — delete and recreate instead. Use list_gmail_filters first to inspect existing filters. Requires the gmail.settings.basic OAuth scope.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | Yes | The user's Google email address (authenticated account). | |
| action | Yes | "create" or "delete". Case-insensitive. | |
| criteria | No | Filter match criteria for create. Keys: from, to, subject, query (Gmail search operators like "label:INBOX older_than:30d"), negatedQuery, hasAttachment, size, sizeComparison, excludeChats. Example: {"from": "newsletter@", "subject": "deal"}. | |
| filter_action | No | What to do on match for create. Keys: addLabelIds (list of label IDs from list_gmail_labels), removeLabelIds, forward (alias email). Example: {"addLabelIds": ["Label_1"], "removeLabelIds": ["INBOX"]}. | |
| filter_id | No | Filter ID from list_gmail_filters. Required for delete. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |