Tool: list_labels
Lists all labels available in the authenticated user's Gmail account. Use this tool to discover the labelId and display name of each label in labels before calling label_thread, unlabel_thread, label_message, or unlabel_message. Note: the system labels, DRAFT and SENT, cannot be set on messages and are read only.
Inbox category tabs are represented by system labels: CATEGORY_PERSONAL (Primary), CATEGORY_SOCIAL (Social), CATEGORY_PROMOTIONS (Promotions), CATEGORY_UPDATES (Updates), and CATEGORY_FORUMS (Forums). A message has at most one category: adding a category label moves the message to that tab and automatically removes its previous category, and removing a category label without adding another moves the message to Primary.
Note: An empty JSON object {} represents zero matching items, not an error.
The following code sample shows how to use curl to call the list_labels 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": "list_labels", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for ListLabels RPC.
Output Schema
Response message for ListLabels RPC.
ListLabelsResponse
| JSON representation |
|---|
{
"labels": [
{
object ( |
| Fields | |
|---|---|
labels[] |
List of all labels in the user's account. |
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.labels.readonlyhttps://www.googleapis.com/auth/gmail.metadatahttps://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.readonly