Skip to main content
Glama
taylorwilsdon

Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

Batch Modify Gmail Message Labels

batch_modify_gmail_message_labels
Destructive

Add or remove Gmail labels across many messages or entire conversations, with optional verification of which message IDs changed and per-thread outcomes.

Instructions

Adds or removes labels on many Gmail messages, or on every message of whole conversations via thread_ids.

message_ids are sent in one users.messages.batchModify call (Gmail accepts up to 1000 ids per call). That endpoint returns no per-message result and silently ignores ids it does not recognise, so by default the messages are read back afterwards to report which ids actually changed.

thread_ids are modified one at a time with users.threads.modify, e.g. archive a conversation with remove_label_ids=["INBOX"] or mark it read with remove_label_ids=["UNREAD"]. Each thread reports its own outcome. message_ids and thread_ids can be combined; at least one is required, as is at least one of add_label_ids or remove_label_ids.

Input Schema

NameRequiredDescriptionDefault
verifyNoRead message_ids back and report per-id outcomes, at the cost of one extra read per id (batched 25 at a time). Set False for very large sweeps where an unverified result is acceptable. Has no effect on thread_ids, which always report per thread.
thread_idsNoThread (conversation) IDs to modify.
message_idsNoMessage IDs to modify.
add_label_idsNoLabel IDs to add.
remove_label_idsNoLabel IDs to remove.
user_google_emailYesThe user's Google email address. Required.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv2.2.0
    • changedInput schema / properties / add_label_ids / description
      Previous value: -"List of label IDs to add to the messages."New value: +"Label IDs to add."
    • addedInput schema / properties / message_ids / default
      Added value: +null
    • changedInput schema / properties / message_ids / description
      Previous value: -"A list of message IDs to modify."New value: +"Message IDs to modify."
    • changedInput schema / properties / remove_label_ids / description
      Previous value: -"List of label IDs to remove from the messages."New value: +"Label IDs to remove."
    • addedInput schema / properties / thread_ids
      Added value: +{
      +  "default": null,
      +  "description": "Thread (conversation) IDs to modify.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedInput schema / properties / verify / description
      Previous value: -"Read the messages back and report per-id outcomes. Costs\none extra (batched) read per id. Set False for very large sweeps\nwhere that cost matters and an unverified result is acceptable."New value: +"Read message_ids back and report per-id outcomes, at the\ncost of one extra read per id (batched 25 at a time). Set False for\nvery large sweeps where an unverified result is acceptable. Has no\neffect on thread_ids, which always report per thread."
    • changedInput schema / required
      Previous value: -[
      -  "user_google_email",
      -  "message_ids"
      -]New value: +[
      +  "user_google_email"
      +]
  2. Changed3 schema fields changedv1.25.2
    • removedInput schema / properties / add_label_ids / anyOf
      Removed value: -[
      -  {
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / remove_label_ids / anyOf
      Removed value: -[
      -  {
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / verify
      Added value: +{
      +  "default": true,
      +  "description": "Read the messages back and report per-id outcomes. Costs\none extra (batched) read per id. Set False for very large sweeps\nwhere that cost matters and an unverified result is acceptable.",
      +  "type": "boolean"
      +}
  3. Addedv1.0.1

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds substantial behavior beyond the annotations: batchModify returns no per-message result, silently ignores unrecognized ids, and defaults to read-back verification with a stated cost. It also explains that thread_ids use a different endpoint and report per-thread outcomes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded and information-dense, with each paragraph serving a clear purpose. It is somewhat long, but the examples and endpoint distinctions earn their space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive batch mutation with full schema descriptions, annotations, and an output schema, the description is complete. It covers the critical endpoint quirks, verification behavior, and parameter interaction needed to call the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the parameters are already documented, but the description adds important semantics: the 1000-id batch limit, per-thread processing, and the requirement that at least one of message_ids or thread_ids and one of add_label_ids or remove_label_ids be supplied. It does not explain every parameter in detail, but it meaningfully supplements the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb and resource: adding or removing labels on many Gmail messages or whole conversations. The batch scope is clear through 'many' and thread-level handling, though it never names the singular sibling modify_gmail_message_labels as the alternative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It clearly distinguishes message_ids versus thread_ids and gives concrete examples such as archiving with remove_label_ids=["INBOX"]. It also states the minimum requirements, but does not explicitly say when to prefer the singular modify_gmail_message_labels tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools