proton_list_folders
Retrieve all mailbox folders with message and unread counts to organize and manage Proton Mail email storage.
Instructions
List all mailbox folders (INBOX, Sent, Drafts, Trash, etc.) with message counts and unread counts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| response_format | No | text |
Implementation Reference
- src/tools/folders.ts:12-68 (handler)The registration and handler logic for the 'proton_list_folders' tool.
server.registerTool( 'proton_list_folders', { title: 'List Proton Mail Folders', description: 'List all mailbox folders (INBOX, Sent, Drafts, Trash, etc.) with message counts and unread counts', inputSchema: ListFoldersSchema, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async (params: z.infer<typeof ListFoldersSchema>) => { try { const folders = await listMailboxes(); if (params.response_format === 'json') { return { content: [ { type: 'text', text: JSON.stringify(folders, null, 2), }, ], }; } // Format as markdown table let result = '| Folder | Messages | Unread |\n'; result += '|--------|----------|--------|\n'; for (const folder of folders) { const name = folder.name || folder.path; result += `| ${name} | ${folder.messageCount} | ${folder.unreadCount} |\n`; } return { content: [ { type: 'text', text: result, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error listing folders: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } ); - src/schemas/index.ts:7-9 (schema)Schema definition for the inputs accepted by the 'proton_list_folders' tool.
export const ListFoldersSchema = z.object({ response_format: z.enum(['text', 'json']).optional().default('text'), });