Preview a mailbox change
preview_actionPreview one mail change and return a single-use approval token; mail is unchanged. Use before moves, archives, label/read-state changes, unsubscribes, or draft deletions; redeem with matching action.
Instructions
Preview one change to existing mail and return a single-use approval token; changes no mail.
Use it first for any move to Trash, Archive or a folder, read-state or label change, unsubscribe or draft deletion; use preview_rules for folder rules. Show the result, wait for the user's explicit approval, then redeem the token only with its action's tool and selector: move(target=the preview's target) for move_to_trash, archive and move_to_folder; set_read_state(state="read" or "unread") for mark_read or mark_unread; label(op="add" or "remove") for add_label or remove_label; delete_draft and unsubscribe under their own names.
A token is issued only for a complete, unprotected clean batch of at most 200 messages, or of at most approval_max_messages when limit asks for more (a bounded approval, run in chunks of at most 200); delete_draft takes at most 200 and unsubscribe at most 50. Any protected sender blocks the whole batch; read-state changes refuse Drafts and Sent. Item-level failures are left out before approval, in excluded_count, excluded_ids (at most 20), excluded_truncated and excluded_reasons; all excluded means no token. create_folder_if_missing=true on a missing Folders/ name returns folder_creation: the one token then binds creating that folder and the move set, and move creates it first.
Returns count, samples (search_mail's canonical handles; partial=true beside a token means only some stayed null), blocked, personal_provider_bypass_count (the batch relies on an approved sender exemption), estimated_calls (confirmations needed), token, expires_at and action_hash; without a token, reason or the blocked rows say why. Move, archive, delete_draft and unsubscribe previews add log_id: that record authorizes nothing and cannot be undone. A partial run may return resume=true and a single-use continuation_token for the same set: redeem it with the same tool and selector, with no new approval; it never widens the set, and its fixed 30-minute window (expires_at) starts at the first successful claim.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | No | RFC Message-IDs from search_mail, including bare identifiers without a domain. Not IMAP UIDs. Pass exactly one of query and ids. | |
| limit | No | Approve only the first clean messages, by folder and numeric UID: 1 to 200, or up to approval_max_messages for one bounded approval. Without it a batch above 200 gets no token. delete_draft and unsubscribe refuse it. | |
| query | No | Filters selecting the complete matching set: folder, from_ (or from), to, subject, since and before. text refuses. Pass exactly one of query and ids. | |
| action | Yes | One of move_to_trash, archive, move_to_folder, mark_read, mark_unread, add_label, remove_label, delete_draft or unsubscribe. | |
| params | No | move_to_folder needs folder, with optional mark_read=false and create_folder_if_missing=false. add_label and remove_label need label. The others take none. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||