Skip to main content
Glama
ggiraudon

Email MCP Server

by ggiraudon

deleteMessage

Remove specific emails from designated folders using unique message identifiers to manage email storage and organization.

Instructions

Deletes a message by UID from a given folder.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderYes
uidYes

Implementation Reference

  • The execute function implementing the 'deleteMessage' tool logic. Validates args, gets IMAP controller, connects, deletes message by folder and UID, returns success.
    async execute(args, context) {
      if (!args || typeof args !== 'object' || !('folder' in args) || !('uid' in args)) {
        throw new Error("Missing required arguments");
      }
      const controller = ImapControllerFactory.getInstance();
      await controller.connect();
      await controller.deleteMessage(args.folder, args.uid);
      return JSON.stringify({ success: true });
    }
  • Zod schema defining input parameters for deleteMessage tool: folder (string) and uid (number).
    export const DeleteMessageInput = z.object({
      folder: z.string().min(2).max(100),
      uid: z.number()
    });
  • src/index.ts:49-49 (registration)
    Registration of the DeleteMessageTool with the MCP server.
    server.addTool(DeleteMessageTool);
  • Helper method in ImapController that opens the folder, adds \Deleted flag to the message by UID, and expunges it.
    deleteMessage(folder: string, uid: number): 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, '\\Deleted', (err: Error | null) => {
                    if (err) return reject(err);
                    this.imap.expunge(uid, (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 the full burden of behavioral disclosure. It states the deletion action but lacks critical details: whether deletion is permanent or reversible, if it requires specific permissions, what happens on success/failure, or any rate limits. This is a significant gap for a destructive operation with zero annotation coverage.

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 front-loads the core action ('Deletes') and directly states the parameters, making it easy to parse quickly. Every part of the sentence earns its place by conveying essential information.

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 tool's complexity (a destructive deletion operation), lack of annotations, no output schema, and 0% schema description coverage, the description is incomplete. It doesn't address behavioral risks, return values, error conditions, or parameter details, leaving the agent with insufficient context to use the tool safely and effectively.

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 for undocumented parameters. It mentions 'UID' and 'folder' but adds minimal semantics beyond naming them—no explanation of what a UID is, valid folder formats, or constraints. This fails to adequately cover the two required parameters, leaving their meaning unclear.

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 ('Deletes') and resource ('a message by UID from a given folder'), making the purpose specific and understandable. It distinguishes from siblings like 'deleteFolder' by specifying message deletion rather than folder deletion, though it doesn't explicitly contrast with other message-related tools like 'moveMessage' or 'setFlags'.

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. It doesn't mention prerequisites (e.g., needing the message UID and folder name), when not to use it (e.g., for archiving vs. permanent deletion), or refer to sibling tools like 'moveMessage' for relocating messages instead of deleting them.

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