list-calendars
Retrieve and manage all calendars from the macOS Calendar application. This tool integrates directly with macOS Calendar via the MCP Server, enabling users to list calendars without OAuth setup.
Instructions
列出所有macOS日历
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- macos-calendar-mcp.js:142-157 (handler)Core handler function for 'list-calendars' tool. Executes AppleScript via osascript to fetch calendar names from macOS Calendar app, splits the result, and returns formatted list.listCalendars() { try { const script = `tell application "Calendar" to get name of calendars`; const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' }); const calendars = result.trim().split(', '); return { content: [{ type: "text", text: `📅 可用日历 (${calendars.length}个):\n${calendars.map(cal => `• ${cal}`).join('\n')}` }] }; } catch (error) { throw new Error(`获取日历列表失败: ${error.message}`); } }
- macos-calendar-mcp-v2.js:246-261 (handler)Core handler function for 'list-calendars' tool in v2. Identical implementation to v1: uses osascript to list macOS calendars.listCalendars() { try { const script = `tell application "Calendar" to get name of calendars`; const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' }); const calendars = result.trim().split(', '); return { content: [{ type: "text", text: `📅 可用日历 (${calendars.length}个):\n${calendars.map(cal => `• ${cal}`).join('\n')}` }] }; } catch (error) { throw new Error(`获取日历列表失败: ${error.message}`); } }
- macos-calendar-mcp-sdk.js:298-315 (handler)Core handler function for 'list-calendars' in MCP SDK version. Async wrapper with identical AppleScript logic for listing calendars.async listCalendars() { try { const script = `tell application "Calendar" to get name of calendars`; const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' }); const calendars = result.trim().split(', '); return { content: [ { type: 'text', text: `📅 可用日历 (${calendars.length}个):\n${calendars.map(cal => `• ${cal}`).join('\n')}`, }, ], }; } catch (error) { throw new Error(`获取日历列表失败: ${error.message}`); } }
- macos-calendar-mcp.js:29-37 (schema)Input schema definition for the 'list-calendars' tool, specifying no required parameters.{ name: "list-calendars", description: "列出所有macOS日历", inputSchema: { type: "object", properties: {}, additionalProperties: false } },
- macos-calendar-mcp.js:119-120 (registration)Tool dispatch registration in the main callTool switch statement.case "list-calendars": return this.listCalendars();