deleteFolder
Remove unwanted folders from your IMAP email account to organize your mailbox and manage storage efficiently.
Instructions
Deletes a folder from the IMAP account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folderName | Yes |
Implementation Reference
- src/tools/DeleteFolderTool.ts:14-22 (handler)The execute function of the DeleteFolderTool that implements the core logic: validates input, obtains IMAP controller instance, connects, deletes the folder, and returns success.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.deleteFolder(args.folderName); return JSON.stringify({ success: true }); }
- src/tools/DeleteFolderTool.ts:5-7 (schema)Zod schema defining the input for the deleteFolder tool: folderName as string between 2-100 chars.export const DeleteFolderInput = z.object({ folderName: z.string().min(2).max(100) });
- src/index.ts:48-48 (registration)Registers the DeleteFolderTool with the FastMCP server.server.addTool(DeleteFolderTool);
- ImapController method that performs the actual folder deletion via imap.delBox callback.deleteFolder(folderName: string): Promise<void> { return new Promise((resolve, reject) => { this.imap.delBox(folderName, (err: Error | null) => { if (err) return reject(err); resolve(); }); }); }
- src/index.ts:8-8 (registration)Import statement for DeleteFolderTool used in registration.import { DeleteFolderTool } from "./tools/DeleteFolderTool.js";