Skip to main content
Glama

remove_label

Remove a specific label from an email message in Gmail to help organize your inbox and categorize messages more effectively.

Instructions

Remove a label from an email

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelIdYesLabel ID to remove
messageIdYesEmail message ID

Implementation Reference

  • Tool handler for 'remove_label': validates arguments using Zod schema, calls GmailService.removeLabel, and returns success message.
    case "remove_label": { const v = validated as z.infer<typeof schemas.remove_label>; await gmailService.removeLabel(v.messageId, v.labelId); return { content: [{ type: "text", text: `Label ${v.labelId} removed from email ${v.messageId}.` }] }; }
  • Zod input schema definition for the 'remove_label' tool, specifying messageId and labelId parameters.
    remove_label: z.object({ messageId: z.string().describe("Email message ID"), labelId: z.string().describe("Label ID to remove") }),
  • src/tools.ts:50-55 (registration)
    Function that generates tool definitions for all tools, including 'remove_label', by iterating over schemas and toolDescriptions for MCP registration.
    export const getToolDefinitions = () => Object.entries(schemas).map(([name, schema]) => ({ name, description: toolDescriptions[name], inputSchema: zodToJsonSchema(schema) }));
  • GmailService method implementing label removal by calling Gmail API's modifyMessage with removeLabelIds.
    async removeLabel(messageId: string, labelId: string): Promise<void> { await this.modifyMessage(messageId, { removeLabelIds: [labelId] }); }

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/muammar-yacoob/GMail-Manager-MCP'

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