modify_labels
Add or remove labels on Gmail messages selected by ID or search query. Modifies matches in batches of 1,000 per API call.
Instructions
Add and/or remove labels on a SELECTION of messages — one id, a list of ids, or a Gmail search query (act on everything it matches). One message is just a selection of size one; there is no separate bulk vs single. Matches are modified in batches of 1000 in a single API call each. Labels accept ids or names (resolved to existing labels; does not create new ones). This is the general mutator: archive = remove INBOX, mark-read = remove UNREAD, star = add STARRED, etc. To send mail to Trash use the trash tool.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| add | No | Label ids or names to add. | |
| query | No | Gmail search query; acts on EVERY matching message. Mutually-exclusive-ish with message_id(s). | |
| remove | No | Label ids or names to remove. | |
| account | Yes | Email address of the authorized Gmail account to act on. | |
| message_id | No | A single message id (selection of one). | |
| message_ids | No | An explicit list of message ids to act on. |