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
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | The color settings for the label | |
| id | Yes | The ID of the label to update | |
| labelListVisibility | No | The visibility of the label in the label list | |
| messageListVisibility | No | The visibility of messages with this label in the message list | |
| name | No | The 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) }) } )
- src/index.ts:525-531 (handler)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) }) }
- src/index.ts:515-523 (schema)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")