Skip to main content
Glama

remove_label

Remove a label from a specific Gmail message to declutter your inbox and improve email organization.

Instructions

Remove a label from an email

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageIdYesEmail message ID
labelIdYesLabel ID to remove

Implementation Reference

  • The main handler logic for the 'remove_label' tool. Validates input using the schema and calls GmailService.removeLabel, then 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 schema defining input parameters for remove_label tool: messageId (string) and labelId (string).
    remove_label: z.object({ messageId: z.string().describe("Email message ID"), labelId: z.string().describe("Label ID to remove") }),
  • src/tools.ts:44-44 (registration)
    Tool description for 'remove_label' used when registering the tool via getToolDefinitions().
    remove_label: "Remove a label from an email",
  • GmailService method implementing the label removal by calling modifyMessage with removeLabelIds.
    async removeLabel(messageId: string, labelId: string): Promise<void> { await this.modifyMessage(messageId, { removeLabelIds: [labelId] }); }
  • Private helper method in GmailService that performs the actual Gmail API call to modify message labels.
    private async modifyMessage(id: string, requestBody: any): Promise<void> { await this.gmail.users.messages.modify({ userId: 'me', id, requestBody }); }

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