Skip to main content
Glama
ggiraudon
by ggiraudon

createFolder

Create a new folder in your IMAP email account to organize messages and improve email management.

Instructions

Creates a new folder in the IMAP account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderNameYes

Implementation Reference

  • The main tool implementation including the execute handler that uses ImapController to create the folder.
    export const CreateFolderTool: Tool<any, typeof CreateFolderInput> = { name: "createFolder", description: "Creates a new folder in the IMAP account.", parameters: CreateFolderInput, async execute(args, context) { if (!args || typeof args !== 'object' || !('folderName' in args)) { throw new Error("Missing required arguments"); } const controller = ImapControllerFactory.getInstance(); await controller.connect(); await controller.createFolder(args.folderName); return JSON.stringify({ success: true }); } };
  • Zod schema defining the input for the createFolder tool (folderName string).
    export const CreateFolderInput = z.object({ folderName: z.string().min(2).max(100) });
  • src/index.ts:47-47 (registration)
    Registration of the CreateFolderTool with the FastMCP server.
    server.addTool(CreateFolderTool);
  • Helper method in ImapController that performs the actual IMAP folder creation using imap.addBox.
    createFolder(folderName: string): Promise<void> { return new Promise((resolve, reject) => { this.imap.addBox(folderName, (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