Skip to main content
Glama

update_label

Modify Gmail labels by updating their name, visibility settings, or color attributes to improve email organization and readability. Use this tool to manage label behavior in message and label lists.

Instructions

Update an existing label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorNoThe color settings for the label
idYesThe ID of the label to update
labelListVisibilityNoThe visibility of the label in the label list
messageListVisibilityNoThe visibility of messages with this label in the message list
nameNoThe display name of the label

Implementation Reference

  • src/index.ts:513-532 (registration)
    Registration of the 'update_label' tool, including schema definition and inline handler function that updates a Gmail label using the Gmail API.
    server.tool("update_label", "Update an existing label", { id: z.string().describe("The ID of the label to update"), name: z.string().optional().describe("The display name of the label"), messageListVisibility: z.enum(['show', 'hide']).optional().describe("The visibility of messages with this label in the message list"), labelListVisibility: z.enum(['labelShow', 'labelShowIfUnread', 'labelHide']).optional().describe("The visibility of the label in the label list"), color: z.object({ textColor: z.string().describe("The text color of the label as hex string"), backgroundColor: z.string().describe("The background color of the label as hex string") }).optional().describe("The color settings for the label") }, async (params) => { const { id, ...labelData } = params return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.labels.update({ userId: 'me', id, requestBody: labelData }) return formatResponse(data) }) } )
  • The handler function for the update_label tool. It extracts the label ID and data, then uses handleTool to call Gmail API's users.labels.update.
    async (params) => { const { id, ...labelData } = params return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.labels.update({ userId: 'me', id, requestBody: labelData }) return formatResponse(data) }) }
  • Zod schema defining the input parameters for the update_label tool: required id, optional name, visibilities, and color.
    { id: z.string().describe("The ID of the label to update"), name: z.string().optional().describe("The display name of the label"), messageListVisibility: z.enum(['show', 'hide']).optional().describe("The visibility of messages with this label in the message list"), labelListVisibility: z.enum(['labelShow', 'labelShowIfUnread', 'labelHide']).optional().describe("The visibility of the label in the label list"), color: z.object({ textColor: z.string().describe("The text color of the label as hex string"), backgroundColor: z.string().describe("The background color of the label as hex string") }).optional().describe("The color settings for the label")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shinzo-labs/gmail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server