Skip to main content
Glama
ggiraudon

Email MCP Server

by ggiraudon

ClearMessageFlagsTool

Remove flags from email messages to manage message status and organization in your email server.

Instructions

Clears flags on a message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderYes
uidYes
flagsYes

Implementation Reference

  • The main handler for the ClearMessageFlagsTool, defining the tool metadata and execute function which validates input, connects to the IMAP controller, clears the flags, and returns success.
    export const ClearMessageFlagsTool: Tool<any, typeof ClearMessageFlagsToolInput> = { name: "ClearMessageFlagsTool", description: "Clears flags on a message.", parameters: ClearMessageFlagsToolInput, async execute(args, context) { if (!args || typeof args !== 'object' || !('folder' in args) || !('uid' in args) || !('flags' in args)) { throw new Error("Missing required arguments"); } const controller = ImapControllerFactory.getInstance(); await controller.connect(); await controller.ClearMessageFlagsTool(args.folder, args.uid, args.flags); return JSON.stringify({ success: true }); } };
  • Zod schema defining the input parameters for ClearMessageFlagsTool: folder (string), uid (number), flags (string or string array).
    export const ClearMessageFlagsToolInput = z.object({ folder: z.string().min(2).max(100), uid: z.number(), flags: z.union([z.string(), z.array(z.string())]) });
  • src/index.ts:46-46 (registration)
    Registers the ClearMessageFlagsTool with the FastMCP server instance.
    server.addTool(ClearMessageFlagsTool);
  • Supporting method in ImapController that opens the specified folder and removes the given flags from the message using node-imap's delFlags.
    ClearMessageFlagsTool(folder: string, uid: number, flags: string | string[]): Promise<void> { return new Promise((resolve, reject) => { this.imap.openBox(folder, false, (err: Error | null, box: Imap.Box | null) => { if (err) return reject(err); this.imap.delFlags(uid, flags, (err: Error | null) => { if (err) return reject(err); resolve(); }); }); }); }

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/ggiraudon/emailMCPServer'

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