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 ( |
| Fields | |
|---|---|
labelId |
Required. The unique identifier of the label to modify. Use the |
Union field
|
|
displayName |
Optional. The human-readable display name of the label. |
Union field
|
|
color |
Deprecated: Do not use. Use |
Union field
|
|
colorPreset |
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
|
|
messageListVisibility |
Optional. The new visibility of messages with this label in the message list in the Gmail web interface. |
Union field
|
|
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: Do not use. Use |
backgroundColor |
Deprecated: Do not use. Use |
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 ( |
| Fields | |
|---|---|
labelId |
The unique identifier of the label. |
name |
The human-readable display name of the label. |
color |
Deprecated: Do not use. Use |
Union field
|
|
threadsTotal |
The total number of threads under the label. |
Union field
|
|
threadsUnread |
The number of unread threads under the label. |
Union field
|
|
messagesTotal |
The total number of messages under the label. |
Union field
|
|
messagesUnread |
The number of unread messages under the label. |
Union field
|
|
colorPreset |
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
|
|
labelType |
Optional. The type of the label (system or user-defined). |
Union field
|
|
messageListVisibility |
Optional. The visibility of messages with this label in the message list. |
Union field
|
|
labelListVisibility |
Optional. The visibility of the label in the label list. |
LabelColor
| JSON representation |
|---|
{ "textColor": string, "backgroundColor": string } |
| Fields | |
|---|---|
textColor |
Deprecated: Do not use. Use |
backgroundColor |
Deprecated: Do not use. Use |
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.labelshttps://www.googleapis.com/auth/gmail.modify