get_mailboxes
Retrieve and list all available mailboxes from your iCloud account to organize and access your email folders.
Instructions
List all available mailboxes
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_mailboxes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/lib/icloud-mail-client.ts:228-238 (handler)Core implementation of getMailboxes() that calls IMAP client.getBoxes() to retrieve all mailboxes and returns ImapBoxes.
async getMailboxes(): Promise<ImapBoxes> { return new Promise((resolve, reject) => { this.imap.getBoxes((err: Error, boxes: ImapBoxes) => { if (err) { reject(err); return; } resolve(boxes); }); }); } - src/index.ts:467-485 (handler)MCP server request handler for 'get_mailboxes' tool: validates connection, calls client.getMailboxes(), and formats response as JSON text content.
case 'get_mailboxes': { if (!mailClient) { throw new McpError( ErrorCode.InvalidRequest, 'iCloud Mail not configured. Please set ICLOUD_EMAIL and ICLOUD_APP_PASSWORD environment variables.' ); } const mailboxes = await mailClient.getMailboxes(); return { content: [ { type: 'text', text: JSON.stringify(mailboxes, null, 2), }, ], }; } - src/index.ts:130-137 (registration)Registers the 'get_mailboxes' tool in the MCP server's listTools response with name, description, and empty input schema (no parameters required).
{ name: 'get_mailboxes', description: 'List all available mailboxes', inputSchema: { type: 'object', properties: {}, }, }, - src/lib/icloud-mail-client.ts:26-28 (schema)TypeScript interface defining the structure of mailboxes returned by getMailboxes().
interface ImapBoxes { [boxName: string]: ImapBox; }