Skip to main content
Glama

modify_message

Add or remove labels from a specific Gmail message using its ID. Streamline email organization by updating label assignments directly through Gmail MCP.

Instructions

Modify the labels on a message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addLabelIdsNoA list of label IDs to add to the message
idYesThe ID of the message to modify
removeLabelIdsNoA list of label IDs to remove from the message

Implementation Reference

  • src/index.ts:625-638 (registration)
    Registration of the 'modify_message' tool, including description, input schema, and inline handler function.
    server.tool("modify_message", "Modify the labels on a message", { id: z.string().describe("The ID of the message to modify"), addLabelIds: z.array(z.string()).optional().describe("A list of label IDs to add to the message"), removeLabelIds: z.array(z.string()).optional().describe("A list of label IDs to remove from the message") }, async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.messages.modify({ userId: 'me', id: params.id, requestBody: { addLabelIds: params.addLabelIds, removeLabelIds: params.removeLabelIds } }) return formatResponse(data) }) } )
  • Handler function that executes the tool logic: calls handleTool wrapper which authenticates and invokes Gmail API users.messages.modify to update labels on a specific message.
    async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.messages.modify({ userId: 'me', id: params.id, requestBody: { addLabelIds: params.addLabelIds, removeLabelIds: params.removeLabelIds } }) return formatResponse(data) }) }
  • Zod schema defining input parameters for the modify_message tool: message ID (required), optional label IDs to add or remove.
    id: z.string().describe("The ID of the message to modify"), addLabelIds: z.array(z.string()).optional().describe("A list of label IDs to add to the message"), removeLabelIds: z.array(z.string()).optional().describe("A list of label IDs to remove from the message") },

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