Skip to main content
Glama

gmail.users.messages.modify

Update a specific Gmail message by adding or removing label IDs and classification label values.

Instructions

Modifies the labels and the Classification Label values on the specified message. For administrators modifying message for users in their organization, requests require authorization with a service account that has domain-wide delegation authority to impersonate users with the https://www.googleapis.com/auth/gmail.modify.restricted scope [HTTP POST] — creates or triggers a change; refused under --readonly safety profiles. Returns the API's response resource as JSON — request body is a JSON ModifyMessageRequest object accepting addClassificationLabels, addLabelIds, removeClassificationLabelIds, removeLabelIds; pass it via params or whole via body_file Siblings over the same resource: batchDelete, batchModify, delete, get, import, insert, list, send, trash, untrash.

Input Schema

NameRequiredDescriptionDefault
idYes[URL path segment] The ID of the message to modify.
queryNoExtra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe.
paramsNoParameter map merged into the request; typed parameters win.
userIdYes[URL path segment] The user's email address. The special value `me` can be used to indicate the authenticated user.me
dry_runNoReturn the request that would be sent, without sending it.
body_fileNoRead the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON ModifyMessageRequest object.
request_bodyNoRequest body of type ModifyMessageRequest: pass it via `params` (merged into the built body) or whole via `body_file`.

Output Schema

NameRequiredDescriptionDefault
idNo
rawNo
payloadNo
snippetNo
labelIdsNo
threadIdNo
historyIdNo
internalDateNo
sizeEstimateNo
classificationLabelValuesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / body_file / description
      Previous value: -"Read the request body from this file ('-' for stdin) instead of building one from the parameters."New value: +"Read the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON ModifyMessageRequest object."
    • addedInput schema / properties / request_body
      Added value: +{
      +  "description": "Request body of type ModifyMessageRequest: pass it via `params` (merged into the built body) or whole via `body_file`.",
      +  "properties": {
      +    "addClassificationLabels": {
      +      "items": {
      +        "properties": {
      +          "fields": {
      +            "items": {
      +              "properties": {
      +                "fieldId": {
      +                  "type": "string"
      +                },
      +                "selection": {
      +                  "type": "string"
      +                }
      +              },
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "labelId": {
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "addLabelIds": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "removeClassificationLabelIds": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "removeLabelIds": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed4 schema fields changed
    • changedInput schema / properties / id / description
      Previous value: -"The ID of the message to modify."New value: +"[URL path segment] The ID of the message to modify."
    • addedInput schema / properties / userId / default
      Added value: +"me"
    • changedInput schema / properties / userId / description
      Previous value: -"The user's email address. The special value `me` can be used to indicate the authenticated user."New value: +"[URL path segment] The user's email address. The special value `me` can be used to indicate the authenticated user."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "classificationLabelValues": {
      +      "items": {
      +        "properties": {
      +          "fields": {
      +            "items": {
      +              "properties": {
      +                "fieldId": {
      +                  "type": "string"
      +                },
      +                "selection": {
      +                  "type": "string"
      +                }
      +              },
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "labelId": {
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "historyId": {
      +      "type": "string"
      +    },
      +    "id": {
      +      "type": "string"
      +    },
      +    "internalDate": {
      +      "type": "string"
      +    },
      +    "labelIds": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "payload": {
      +      "properties": {
      +        "body": {
      +          "properties": {
      +            "attachmentId": {
      +              "type": "string"
      +            },
      +            "data": {
      +              "type": "string"
      +            },
      +            "size": {
      +              "type": "integer"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "filename": {
      +          "type": "string"
      +        },
      +        "headers": {
      +          "items": {
      +            "properties": {
      +              "name": {
      +                "type": "string"
      +              },
      +              "value": {
      +                "type": "string"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "mimeType": {
      +          "type": "string"
      +        },
      +        "partId": {
      +          "type": "string"
      +        },
      +        "parts": {
      +          "items": {
      +            "properties": {
      +              "body": {
      +                "properties": {
      +                  "attachmentId": {
      +                    "type": "string"
      +                  },
      +                  "data": {
      +                    "type": "string"
      +                  },
      +                  "size": {
      +                    "type": "integer"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "filename": {
      +                "type": "string"
      +              },
      +              "headers": {
      +                "items": {
      +                  "properties": {
      +                    "name": {
      +                      "type": "string"
      +                    },
      +                    "value": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "mimeType": {
      +                "type": "string"
      +              },
      +              "partId": {
      +                "type": "string"
      +              },
      +              "parts": {
      +                "items": {
      +                  "properties": {
      +                    "body": {
      +                      "type": "object"
      +                    },
      +                    "filename": {
      +                      "type": "string"
      +                    },
      +                    "headers": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    },
      +                    "mimeType": {
      +                      "type": "string"
      +                    },
      +                    "partId": {
      +                      "type": "string"
      +                    },
      +                    "parts": {
      +                      "items": {
      +                        "type": "object"
      +                      },
      +                      "type": "array"
      +                    }
      +                  },
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "raw": {
      +      "type": "string"
      +    },
      +    "sizeEstimate": {
      +      "type": "integer"
      +    },
      +    "snippet": {
      +      "type": "string"
      +    },
      +    "threadId": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that this mutates state ("creates or triggers a change"), that it is refused under --readonly safety profiles, and the exact OAuth scope/domain-wide delegation requirement for admin impersonation. It does not cover reversibility or rate/limit behavior, keeping it below 5.

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?

Purpose is front-loaded in the first sentence, and the auth and body-passing notes follow logically. It is dense and somewhat run-on with em-dashes, and the trailing sibling inventory is long, but nearly every clause carries usable information.

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

Completeness4/5

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

An output schema exists, so return values needn't be explained, and the description still states that the API response resource is returned as JSON. Auth requirements, mutation semantics, and body construction are all covered; only reversibility and side effects on classification labels are left unstated.

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 coverage is 100%, so the baseline is 3. The description restates the request-body fields (addLabelIds, removeLabelIds, add/removeClassificationLabels) and explains the params vs body_file passing mechanism, adding only marginal meaning beyond what the schema already documents.

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?

States a specific verb+resource: "Modifies the labels and the Classification Label values on the specified message," which is concrete and distinguishable from read/destroy siblings. It enumerates sibling tools but does not explicitly say what makes this one different from batchModify or threads.modify, so sibling differentiation is implied rather than stated.

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

Usage Guidelines3/5

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

Usage is only implied by the name and the mention of modifying a single message; there is no explicit "use this when" or "prefer X instead" guidance. The long sibling list gives context but no routing logic (e.g., batchModify for multiple messages, threads.modify for whole threads).

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