Skip to main content
Glama

batch_modify_labels

Add and/or remove the same labels on many email messages at once in a single Gmail API call (wraps users.messages.batchModify). Use this for bulk operations such as marking multiple specific emails as read (remove ['UNREAD']), archiving (remove ['INBOX']), or starring (add ['STARRED']). Use list_labels to find label IDs (Gmail requires IDs, not names). Common system label IDs: INBOX, STARRED, IMPORTANT, UNREAD, SPAM, TRASH. Provide 1-1000 email IDs and at least one of add or remove. The same label changes are applied to every listed message. Gmail returns no per-message status, so a successful call means Gmail accepted the request; an invalid email ID or label ID typically causes Gmail to reject it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addNoLabel IDs to add to every message (e.g., ['STARRED', 'Label_123'])
removeNoLabel IDs to remove from every message (e.g., ['UNREAD', 'INBOX'])
emailIdsYesEmail IDs to modify (1-1000, from search_email or get_email)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYes
addedLabelsYes
acceptedCountYesNumber of (deduplicated) message IDs the batch request was accepted for. Gmail returns no per-message status, so this is not necessarily the number of messages whose labels actually changed.
removedLabelsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior4/5

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

Disclosures that Gmail returns no per-message status and that invalid IDs cause rejection. While annotations indicate non-destructive, the description adds behavioral context about API behavior and error handling.

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?

Well-structured and front-loaded with core purpose, but slightly verbose. Each sentence earns its place given the complexity of the operation.

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?

Comprehensive coverage: explains prerequisites (list_labels, email IDs from search_email/get_email), constraints, and consequences (no per-message status). No missing gaps for a batch labeling tool.

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

Parameters5/5

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

Adds significant value beyond schema by clarifying that at least one of add/remove is needed, explaining Gmail requires label IDs not names, and providing common system label IDs. Schema coverage is 100% but description enriches with practical usage.

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

Purpose5/5

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

Effectively states it adds/removes labels on many email messages at once via Gmail API. Clearly distinguishes from sibling tools like add_labels and remove_labels which operate on single messages.

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

Usage Guidelines5/5

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

Provides explicit when-to-use for bulk operations like marking as read, archiving, starring. Advises using list_labels for IDs, specifies constraints (1-1000 IDs, at least one add/remove), and warns about no per-message status.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.