update_label
Modify an existing Gmail label's name, visibility settings, or color to organize your inbox more effectively.
Instructions
Update an existing label
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the label to update | |
| name | No | The display name of the label | |
| messageListVisibility | No | The visibility of messages with this label in the message list | |
| labelListVisibility | No | The visibility of the label in the label list | |
| color | No | The color settings for the label |
Implementation Reference
- src/index.ts:510-516 (handler)The handler function that executes the update_label tool logic. It destructures the params to get id and labelData, then uses handleTool to call the Gmail API's users.labels.update method.}, 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:500-509 (schema)The Zod schema defining the input parameters for the update_label tool, including id (required), and optional name, visibilities, and color."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")
- src/index.ts:498-517 (registration)The registration of the update_label tool using server.tool(), including description, schema, and handler.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) }) }