Skip to main content
Glama

Gmail Modify Messages

gmail_modify_messages
DestructiveIdempotent

Change Gmail message or thread state in one call: add or remove labels, mark read or unread, archive or restore to inbox, report spam, or recover from Trash.

Instructions

Change the state of Gmail messages or of one whole conversation: add or remove labels by name or ID, mark read or unread, archive or move back to the inbox, report spam or not spam, or restore from Trash, in one call. Use gmail_delete to move mail to Trash or delete it, and gmail_manage_labels to create or rename labels. Returns status 'ok', the label IDs added and removed, untrashed, processed and messages (id, thread_id, label_ids) when Gmail reports them (one message or a thread). Changing 10 or more message_ids asks the user to confirm first.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "gmail_modify_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
spamNoTrue reports the mail as spam (adds SPAM, removes INBOX); false takes it out of Spam (removes SPAM and adds INBOX, unless archive is true).
archiveNoTrue archives the mail (removes INBOX; it stays in All Mail), false moves it back to the inbox (adds INBOX).
dry_runNoTrue previews the call instead of running it: nothing is sent to Google and the user is not asked. Returns status 'dry_run', preview, action, count (distinct message IDs; null for a thread_id), requested_count (IDs as given) and consent_required: whether the real call would ask the user to confirm.
untrashNoTrue first restores the mail from Trash, undoing gmail_delete with mode 'trash'; permanently deleted mail cannot be restored.
mark_readNoTrue marks the mail read (removes UNREAD), false marks it unread (adds UNREAD).
thread_idNoGmail thread ID (thread_id from search or read results): the change applies to every message of that conversation; give message_ids or thread_id, not both.
add_labelsNoLabels to add. Label names as shown in Gmail (e.g. 'Clients/Acme') or label IDs; system labels such as STARRED, IMPORTANT or INBOX are matched case-insensitively. An unknown or ambiguous name fails with not_found and the candidate labels; no label is created.
message_idsNoGmail message IDs to change, 1 to 1,000, from gmail_search_emails, gmail_get_mail_digest or gmail_read_emails; give message_ids or thread_id, not both.
remove_labelsNoLabels to remove. Label names as shown in Gmail (e.g. 'Clients/Acme') or label IDs; system labels such as STARRED, IMPORTANT or INBOX are matched case-insensitively. An unknown or ambiguous name fails with not_found and the candidate labels; no label is created.

Output Schema

NameRequiredDescriptionDefault
statusNoMachine-readable operation status.
messagesNo
processedNo
thread_idNo
untrashedNo
message_idsNo
added_label_idsNo
removed_label_idsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.2.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, idempotentHint=true and openWorldHint=true, so the mutation risk is known. The description adds genuinely new behavior not in the structured fields: the >=10 message_ids user-confirmation gate. It also notes the untrash limitation indirectly, though most undo/preview detail lives in the dry_run and untrash parameter descriptions rather than in the tool description.

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?

Front-loaded with the capability list, then alternatives, then return shape and the confirmation rule — a sensible ordering. The final sentence describing returned fields ('status ok, label IDs added and removed, untrashed, processed and messages...') is partly redundant given an output schema exists, which keeps it from a 5.

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?

With 9 parameters, full schema coverage, annotations, and an output schema, the description covers purpose, alternatives, the confirmation safeguard, and irreversible-delete caveats. Nothing an agent needs in order to invoke this correctly is missing.

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

Parameters3/5

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

Schema description coverage is 100% and each parameter already documents its own semantics (label name vs ID, message_ids vs thread_id exclusivity, dry_run return shape). The description only restates the operation set at a high level ('by name or ID', 'one whole conversation') without adding format or edge-case detail beyond the schema, so the baseline 3 applies.

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?

The description opens with a specific verb+resource ('Change the state of Gmail messages or of one whole conversation') and then enumerates the concrete state transitions: label add/remove, read/unread, archive/inbox, spam, and Trash restore. It also names the siblings it is NOT (gmail_delete, gmail_manage_labels), so an agent can separate it from adjacent tools without opening any schema.

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?

It gives explicit routing rules with named alternatives: 'Use gmail_delete to move mail to Trash or delete it, and gmail_manage_labels to create or rename labels.' It also states the confirmation threshold ('Changing 10 or more message_ids asks the user to confirm first'), which affects how an agent should batch calls.

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