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();
                });
            });
        });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Clears flags') but lacks critical details: whether this is a mutation (implied by 'Clears'), what permissions are needed, if it's reversible, rate limits, or what happens on success/failure. For a tool with 3 required parameters and no annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place, though this conciseness comes at the cost of completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (3 required parameters, mutation implied, no annotations, no output schema), the description is incomplete. It doesn't cover parameter meanings, behavioral traits, usage context, or return values. For a tool that modifies message states, this leaves too many gaps for reliable agent operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain what 'folder', 'uid', or 'flags' represent, their formats, or examples (e.g., flags as strings like '\Seen' or arrays). With 3 undocumented parameters, the description fails to provide meaningful semantics beyond the tool name.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Clears') and resource ('flags on a message'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'setFlags' or 'deleteMessage', but it's specific enough to convey the core function without being tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'setFlags' (which might set or modify flags) or 'deleteMessage' (which removes messages entirely). There's no mention of prerequisites, context, or exclusions, leaving the agent to infer usage from tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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