list_mailboxes
Retrieve all email folders and mailboxes from iCloud Mail to organize and manage your email structure effectively.
Instructions
List all mailboxes/folders in iCloud Mail
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- lib/imap.js:1567-1581 (handler)Implementation of list_mailboxes tool which connects to the IMAP server, retrieves the folder tree, and flattens it into a list of mailbox objects containing name and path.
export async function listMailboxes(creds = null) { const client = createRateLimitedClient(creds); await client.connect(); const tree = await client.listTree(); const mailboxes = []; function walk(items) { for (const item of items) { mailboxes.push({ name: item.name, path: item.path }); if (item.folders && item.folders.length > 0) walk(item.folders); } } walk(tree.folders); await client.logout(); return mailboxes; }