MCP Tools Reference: gmailmcp.googleapis.com

Tool: update_label

Modifies an existing label's name, color, and visibility settings in the user's Gmail account.

The following code sample shows how to use curl to call the update_label MCP tool.

Curl Request
curl --location 'https://gmailmcp.googleapis.com/mcp/v1' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "update_label",
    "arguments": {
      // Provide these details according to the MCP tool specification.
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'

Input Schema

Request message for UpdateLabel RPC.

UpdateLabelRequest

JSON representation
{
  "labelId": string,
  "displayName": string,
  "color": {
    object (LabelColor)
  },
  "colorPreset": enum (LabelColorPreset),
  "messageListVisibility": enum (MessageListVisibility),
  "labelListVisibility": enum (LabelListVisibility)
}
Fields
labelId

string

Required. The unique identifier of the label to modify. Use the list_labels tool to get the corresponding label id to a display name for user-defined labels.

Union field _display_name.

_display_name can be only one of the following:

displayName

string

Optional. The human-readable display name of the label.

Union field _color.

_color can be only one of the following:

color
(deprecated)

object (LabelColor)

Deprecated: Do not use. Use colorPreset instead. Legacy field for raw text and background color hex strings.

Union field _color_preset.

_color_preset can be only one of the following:

colorPreset

enum (LabelColorPreset)

Optional. The new color preset tile to assign to the label. Select from predefined contrast-safe color options (e.g., LABEL_COLOR_PRESET_RED, LABEL_COLOR_PRESET_BLUE, LABEL_COLOR_PRESET_BLACK, LABEL_COLOR_PRESET_GREEN). If omitted, existing label color is preserved.

Union field _message_list_visibility.

_message_list_visibility can be only one of the following:

messageListVisibility

enum (MessageListVisibility)

Optional. The new visibility of messages with this label in the message list in the Gmail web interface.

Union field _label_list_visibility.

_label_list_visibility can be only one of the following:

labelListVisibility

enum (LabelListVisibility)

Optional. The new visibility of the label in the label list in the Gmail web interface.

LabelColor

JSON representation
{
  "textColor": string,
  "backgroundColor": string
}
Fields
textColor
(deprecated)

string

Deprecated: Do not use. Use LabelColorPreset instead. The text color of the label, specified as either a 6-digit hex string (e.g., #ffffff) or a supported color name.

backgroundColor
(deprecated)

string

Deprecated: Do not use. Use LabelColorPreset instead. The background color of the label, specified as either a 6-digit hex string (e.g., #000000) or a supported color name.

LabelColorPreset

Label color presets matching the 21 contrast-safe color tiles in the Gmail UI color picker.

Enums
LABEL_COLOR_PRESET_UNSPECIFIED Default unspecified label color preset.
LABEL_COLOR_PRESET_BLACK Black label color tile (#000000 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_GRAY Dark Gray label color tile (#434343 background with #ffffff text).
LABEL_COLOR_PRESET_GRAY Gray label color tile (#666666 background with #ffffff text).
LABEL_COLOR_PRESET_LIGHT_GRAY Light Gray label color tile (#cccccc background with #000000 text).
LABEL_COLOR_PRESET_WHITE White label color tile (#ffffff background with #000000 text).
LABEL_COLOR_PRESET_RED Red label color tile (#fb4c2f background with #ffffff text).
LABEL_COLOR_PRESET_ORANGE Orange label color tile (#ffad47 background with #000000 text).
LABEL_COLOR_PRESET_YELLOW Yellow label color tile (#fad165 background with #000000 text).
LABEL_COLOR_PRESET_GREEN Green label color tile (#16a765 background with #ffffff text).
LABEL_COLOR_PRESET_MINT Mint label color tile (#43d692 background with #000000 text).
LABEL_COLOR_PRESET_TEAL Teal label color tile (#2da2bb background with #ffffff text).
LABEL_COLOR_PRESET_BLUE Blue label color tile (#4a86e8 background with #ffffff text).
LABEL_COLOR_PRESET_PURPLE Purple label color tile (#a479e2 background with #ffffff text).
LABEL_COLOR_PRESET_PINK Pink label color tile (#f691b2 background with #000000 text).
LABEL_COLOR_PRESET_DARK_RED Dark Red label color tile (#822111 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_ORANGE Dark Orange label color tile (#a46a21 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_GREEN Dark Green label color tile (#076239 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_BLUE Dark Blue label color tile (#1c4587 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_PURPLE Dark Purple label color tile (#41236d background with #ffffff text).
LABEL_COLOR_PRESET_DARK_PINK Dark Pink label color tile (#83334c background with #ffffff text).
LABEL_COLOR_PRESET_BROWN Brown label color tile (#7a4706 background with #ffffff text).

MessageListVisibility

The visibility of messages with this label in the message list in the Gmail web interface.

Enums
MESSAGE_LIST_VISIBILITY_UNSPECIFIED Unspecified message list visibility.
SHOW Show the label in the message list.
HIDE Do not show the label in the message list.

LabelListVisibility

The visibility of the label in the label list in the Gmail web interface.

Enums
LABEL_LIST_VISIBILITY_UNSPECIFIED Unspecified label list visibility.
LABEL_SHOW Show the label in the label list.
LABEL_SHOW_IF_UNREAD Show the label if there are any unread messages with that label.
LABEL_HIDE Do not show the label in the label list.

Output Schema

Details of a label.

Label

JSON representation
{
  "labelId": string,
  "name": string,
  "color": {
    object (LabelColor)
  },
  "threadsTotal": integer,
  "threadsUnread": integer,
  "messagesTotal": integer,
  "messagesUnread": integer,
  "colorPreset": enum (LabelColorPreset),
  "labelType": enum (LabelType),
  "messageListVisibility": enum (MessageListVisibility),
  "labelListVisibility": enum (LabelListVisibility)
}
Fields
labelId

string

The unique identifier of the label.

name

string

The human-readable display name of the label.

color
(deprecated)

object (LabelColor)

Deprecated: Do not use. Use colorPreset instead. Legacy field for raw text and background color hex strings.

Union field _threads_total.

_threads_total can be only one of the following:

threadsTotal

integer

The total number of threads under the label.

Union field _threads_unread.

_threads_unread can be only one of the following:

threadsUnread

integer

The number of unread threads under the label.

Union field _messages_total.

_messages_total can be only one of the following:

messagesTotal

integer

The total number of messages under the label.

Union field _messages_unread.

_messages_unread can be only one of the following:

messagesUnread

integer

The number of unread messages under the label.

Union field _color_preset.

_color_preset can be only one of the following:

colorPreset

enum (LabelColorPreset)

Optional. The color preset tile assigned to the label (e.g., LABEL_COLOR_PRESET_RED, LABEL_COLOR_PRESET_BLUE). Represents a pre-configured contrast-safe text and background color pair from the Gmail UI color palette. Returns LABEL_COLOR_PRESET_UNSPECIFIED if the label has a custom hex color.

Union field _label_type.

_label_type can be only one of the following:

labelType

enum (LabelType)

Optional. The type of the label (system or user-defined).

Union field _message_list_visibility.

_message_list_visibility can be only one of the following:

messageListVisibility

enum (MessageListVisibility)

Optional. The visibility of messages with this label in the message list.

Union field _label_list_visibility.

_label_list_visibility can be only one of the following:

labelListVisibility

enum (LabelListVisibility)

Optional. The visibility of the label in the label list.

LabelColor

JSON representation
{
  "textColor": string,
  "backgroundColor": string
}
Fields
textColor
(deprecated)

string

Deprecated: Do not use. Use LabelColorPreset instead. The text color of the label, specified as either a 6-digit hex string (e.g., #ffffff) or a supported color name.

backgroundColor
(deprecated)

string

Deprecated: Do not use. Use LabelColorPreset instead. The background color of the label, specified as either a 6-digit hex string (e.g., #000000) or a supported color name.

LabelColorPreset

Label color presets matching the 21 contrast-safe color tiles in the Gmail UI color picker.

Enums
LABEL_COLOR_PRESET_UNSPECIFIED Default unspecified label color preset.
LABEL_COLOR_PRESET_BLACK Black label color tile (#000000 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_GRAY Dark Gray label color tile (#434343 background with #ffffff text).
LABEL_COLOR_PRESET_GRAY Gray label color tile (#666666 background with #ffffff text).
LABEL_COLOR_PRESET_LIGHT_GRAY Light Gray label color tile (#cccccc background with #000000 text).
LABEL_COLOR_PRESET_WHITE White label color tile (#ffffff background with #000000 text).
LABEL_COLOR_PRESET_RED Red label color tile (#fb4c2f background with #ffffff text).
LABEL_COLOR_PRESET_ORANGE Orange label color tile (#ffad47 background with #000000 text).
LABEL_COLOR_PRESET_YELLOW Yellow label color tile (#fad165 background with #000000 text).
LABEL_COLOR_PRESET_GREEN Green label color tile (#16a765 background with #ffffff text).
LABEL_COLOR_PRESET_MINT Mint label color tile (#43d692 background with #000000 text).
LABEL_COLOR_PRESET_TEAL Teal label color tile (#2da2bb background with #ffffff text).
LABEL_COLOR_PRESET_BLUE Blue label color tile (#4a86e8 background with #ffffff text).
LABEL_COLOR_PRESET_PURPLE Purple label color tile (#a479e2 background with #ffffff text).
LABEL_COLOR_PRESET_PINK Pink label color tile (#f691b2 background with #000000 text).
LABEL_COLOR_PRESET_DARK_RED Dark Red label color tile (#822111 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_ORANGE Dark Orange label color tile (#a46a21 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_GREEN Dark Green label color tile (#076239 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_BLUE Dark Blue label color tile (#1c4587 background with #ffffff text).
LABEL_COLOR_PRESET_DARK_PURPLE Dark Purple label color tile (#41236d background with #ffffff text).
LABEL_COLOR_PRESET_DARK_PINK Dark Pink label color tile (#83334c background with #ffffff text).
LABEL_COLOR_PRESET_BROWN Brown label color tile (#7a4706 background with #ffffff text).

LabelType

The type of the label (system or user-defined).

Enums
LABEL_TYPE_UNSPECIFIED Unspecified label type.
SYSTEM Labels created by Gmail.
USER Custom labels created by the user or application.

MessageListVisibility

The visibility of messages with this label in the message list in the Gmail web interface.

Enums
MESSAGE_LIST_VISIBILITY_UNSPECIFIED Unspecified message list visibility.
SHOW Show the label in the message list.
HIDE Do not show the label in the message list.

LabelListVisibility

The visibility of the label in the label list in the Gmail web interface.

Enums
LABEL_LIST_VISIBILITY_UNSPECIFIED Unspecified label list visibility.
LABEL_SHOW Show the label in the label list.
LABEL_SHOW_IF_UNREAD Show the label if there are any unread messages with that label.
LABEL_HIDE Do not show the label in the label list.

Tool Annotations

Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.

Along with the title string, the following boolean hints are defined as follows:

  • readOnlyHint: If true, the tool doesn't modify its environment. Default: false.
  • destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.
  • idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.
  • openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.

Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ❌

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://mail.google.com/
  • https://www.googleapis.com/auth/gmail.labels
  • https://www.googleapis.com/auth/gmail.modify