mail_get_inbox_count
Retrieve the current number of unread emails in your macOS Mail inbox. Use this tool to monitor email volume without opening the Mail application.
Instructions
Get unread message count in inbox
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:799-834 (handler)Handler function that executes the 'mail_get_inbox_count' tool by running an AppleScript command via osascript to retrieve the unread message count from the Mail application's inbox, parses the stdout output, handles errors, and returns the count in the MCP response format.case 'mail_get_inbox_count': try { const command = `osascript -e 'tell application "Mail" to get unread count of inbox'`; const { stdout, stderr } = await execAsync(command); if (stderr.trim()) { return { content: [ { type: 'text', text: `Error getting inbox count: ${stderr.trim()}`, }, ], }; } const unreadCount = parseInt(stdout.trim()); return { content: [ { type: 'text', text: `Unread messages in inbox: ${unreadCount}`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error executing inbox count command: ${error.message}`, }, ], }; }
- src/index.ts:76-83 (registration)Tool registration in the ListTools handler, including name, description, and input schema (empty object, no parameters required).{ name: 'mail_get_inbox_count', description: 'Get unread message count in inbox', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:79-82 (schema)Input schema definition for the tool: an empty object with no properties or requirements.inputSchema: { type: 'object', properties: {}, },