Skip to main content
Glama
ggiraudon

Email MCP Server

by ggiraudon

setFlags

Set message flags like read/unread or starred to organize and manage emails in IMAP folders.

Instructions

Sets flags on a message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderYes
uidYes
flagsYes

Implementation Reference

  • The execute function of the SetMessageFlagsTool, which handles the tool invocation: validates arguments, connects to IMAP controller, calls setFlags on the message, and returns success.
    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.setFlags(args.folder, args.uid, args.flags);
      return JSON.stringify({ success: true });
    }
  • Zod schema defining the input parameters for the setFlags tool: folder, uid, and flags.
    export const SetFlagsInput = z.object({
      folder: z.string().min(2).max(100),
      uid: z.number(),
      flags: z.union([z.string(), z.array(z.string())])
    });
  • src/index.ts:55-55 (registration)
    Registers the SetMessageFlagsTool with the FastMCP server instance.
    server.addTool(SetMessageFlagsTool);
  • ImapController method that opens the mailbox and uses node-imap's addFlags to set flags on the specified message UID.
    setFlags(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.addFlags(uid, flags, (err: Error | null) => {
                    if (err) return reject(err);
                    resolve();
                });
            });
        });
    }
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('sets flags') but does not explain what this entails—whether it modifies existing flags, adds new ones, overwrites them, or has side effects like notifications. It lacks details on permissions, error conditions, or what happens if flags are invalid. This leaves critical behavioral traits undocumented.

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

Conciseness4/5

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

The description is a single sentence with no wasted words, making it highly concise. However, it is under-specified rather than efficiently informative—it lacks necessary details for a tool with three parameters and no annotations. While structurally simple, it does not earn its place by providing value beyond the name.

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

Completeness1/5

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

Given the complexity (a mutation tool with three parameters, no annotations, and no output schema), the description is severely incomplete. It does not explain the tool's behavior, parameter meanings, return values, or how it fits among siblings. For a tool that modifies message states, this level of documentation is inadequate and leaves the agent guessing.

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

Parameters1/5

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

Schema description coverage is 0%, meaning none of the three parameters (folder, uid, flags) are documented in the schema. The description does not add any meaning beyond the schema—it does not explain what 'folder' refers to (e.g., mailbox folder), what 'uid' is (e.g., message identifier), or what 'flags' represent (e.g., read/unread, starred). This fails to compensate for the schema's lack of documentation.

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

Purpose2/5

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

The description 'Sets flags on a message' restates the tool name 'setFlags' in a tautological manner without adding specificity. It mentions the resource ('message') and action ('sets flags'), but does not clarify what flags are, what they do, or how this differs from sibling tools like ClearMessageFlagsTool. This is a minimal restatement rather than a helpful explanation.

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

Usage Guidelines1/5

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

No guidance is provided on when to use this tool versus alternatives. It does not mention prerequisites (e.g., needing a message in a folder), exclusions, or comparisons to sibling tools like ClearMessageFlagsTool (which likely removes flags) or other message-related tools. The agent must infer usage from the name alone, which is insufficient.

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