Skip to main content
Glama
Racimy

iMail-mcp

create_mailbox

Create a new email folder to organize messages in your iCloud account. Add custom-named mailboxes for better email management and categorization.

Instructions

Create a new mailbox (folder)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the mailbox to create

Implementation Reference

  • MCP tool handler for 'create_mailbox'. Validates client configuration, extracts 'name' parameter, invokes mailClient.createMailbox(), and returns result as formatted JSON.
    case 'create_mailbox': {
      if (!mailClient) {
        throw new McpError(
          ErrorCode.InvalidRequest,
          'iCloud Mail not configured. Please set ICLOUD_EMAIL and ICLOUD_APP_PASSWORD environment variables.'
        );
      }
    
      const mailboxName = args?.name as string;
      const result = await mailClient.createMailbox(mailboxName);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:146-159 (registration)
    Registers the 'create_mailbox' tool in the ListTools response with description and input schema requiring a 'name' string.
    {
      name: 'create_mailbox',
      description: 'Create a new mailbox (folder)',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the mailbox to create',
          },
        },
        required: ['name'],
      },
    },
  • Input schema definition for 'create_mailbox' tool, specifying an object with required 'name' property of type string.
    inputSchema: {
      type: 'object',
      properties: {
        name: {
          type: 'string',
          description: 'Name of the mailbox to create',
        },
      },
      required: ['name'],
    },
  • iCloudMailClient helper method implementing mailbox creation via IMAP addBox, returning success/error status with message.
    async createMailbox(
      name: string
    ): Promise<{ status: string; message: string }> {
      return new Promise((resolve) => {
        this.imap.addBox(name, (err: Error) => {
          if (err) {
            resolve({
              status: 'error',
              message: err.message,
            });
            return;
          }
    
          resolve({
            status: 'success',
            message: `Mailbox '${name}' created successfully`,
          });
        });
      });
    }

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/Racimy/iMail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server