Skip to main content
Glama

list-today-events

Display today's calendar events directly from macOS Calendar using the MCP server. Specify a calendar name to filter results and manage your schedule efficiently without OAuth setup.

Instructions

列出今天的事件

Input Schema

NameRequiredDescriptionDefault
calendarNo日历名称个人

Input Schema (JSON Schema)

{ "additionalProperties": false, "properties": { "calendar": { "default": "个人", "description": "日历名称", "type": "string" } }, "type": "object" }

Implementation Reference

  • Handler function listTodayEvents that executes AppleScript to list today's events from the specified macOS Calendar.
    listTodayEvents(args) { const { calendar = "个人" } = args; const script = ` tell application "Calendar" set theCalendar to calendar "${calendar}" set todayStart to (current date) - (time of (current date)) set todayEnd to todayStart + (24 * hours) - 1 set todayEvents to every event of theCalendar whose start date ≥ todayStart and start date ≤ todayEnd set eventList to {} repeat with anEvent in todayEvents set eventInfo to (summary of anEvent) & "|" & (start date of anEvent) & "|" & (end date of anEvent) & "|" & (description of anEvent) & "|" & (location of anEvent) set end of eventList to eventInfo end repeat return eventList as string end tell `; try { const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' }); const events = result.trim(); if (!events || events === '""') { return { content: [{ type: "text", text: `📅 ${calendar} - 今日无事件` }] }; } const eventList = events.split(',').map(event => { const [title, start, end, desc, loc] = event.trim().split('|'); return `📝 ${title}\n🕒 ${start} - ${end}${loc ? `\n📍 ${loc}` : ''}${desc ? `\n📄 ${desc}` : ''}`; }).join('\n\n'); return { content: [{ type: "text", text: `📅 ${calendar} - 今日事件:\n\n${eventList}` }] }; } catch (error) { throw new Error(`获取今日事件失败: ${error.message}`); } }
  • Handler function listTodayEvents using MCP SDK that executes AppleScript to list today's events from the specified macOS Calendar.
    async listTodayEvents(args) { const { calendar = '个人' } = args; const script = ` tell application "Calendar" set theCalendar to calendar "${calendar}" set todayStart to (current date) - (time of (current date)) set todayEnd to todayStart + (24 * hours) - 1 set todayEvents to every event of theCalendar whose start date ≥ todayStart and start date ≤ todayEnd set eventList to {} repeat with anEvent in todayEvents set eventInfo to (summary of anEvent) & "|" & (start date of anEvent) & "|" & (end date of anEvent) & "|" & (description of anEvent) & "|" & (location of anEvent) set end of eventList to eventInfo end repeat return eventList as string end tell `; try { const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' }); const events = result.trim(); if (!events || events === '""') { return { content: [ { type: 'text', text: `📅 ${calendar} - 今日无事件`, }, ], }; } const eventList = events.split(',').map(event => { const [title, start, end, desc, loc] = event.trim().split('|'); return `📝 ${title}\n🕒 ${start} - ${end}${loc ? `\n📍 ${loc}` : ''}${desc ? `\n📄 ${desc}` : ''}`; }).join('\n\n'); return { content: [ { type: 'text', text: `📅 ${calendar} - 今日事件:\n\n${eventList}`, }, ], }; } catch (error) { throw new Error(`获取今日事件失败: ${error.message}`); } }
  • Handler function listTodayEvents in macOS Calendar MCP v2 that executes AppleScript to list today's events from the specified macOS Calendar.
    listTodayEvents(args) { const { calendar = "个人" } = args; const script = ` tell application "Calendar" set theCalendar to calendar "${calendar}" set todayStart to (current date) - (time of (current date)) set todayEnd to todayStart + (24 * hours) - 1 set todayEvents to every event of theCalendar whose start date ≥ todayStart and start date ≤ todayEnd set eventList to {} repeat with anEvent in todayEvents set eventInfo to (summary of anEvent) & "|" & (start date of anEvent) & "|" & (end date of anEvent) & "|" & (description of anEvent) & "|" & (location of anEvent) set end of eventList to eventInfo end repeat return eventList as string end tell `; try { const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' }); const events = result.trim(); if (!events || events === '""') { return { content: [{ type: "text", text: `📅 ${calendar} - 今日无事件` }] }; } const eventList = events.split(',').map(event => { const [title, start, end, desc, loc] = event.trim().split('|'); return `📝 ${title}\n🕒 ${start} - ${end}${loc ? `\n📍 ${loc}` : ''}${desc ? `\n📄 ${desc}` : ''}`; }).join('\n\n'); return { content: [{ type: "text", text: `📅 ${calendar} - 今日事件:\n\n${eventList}` }] }; } catch (error) { throw new Error(`获取今日事件失败: ${error.message}`); } }
  • Input schema definition for list-today-events tool.
    name: "list-today-events", description: "列出今天的事件", inputSchema: { type: "object", properties: { calendar: { type: "string", description: "日历名称", default: "个人" } }, additionalProperties: false }
  • Tool registration in callTool switch statement.
    case "list-today-events": return this.listTodayEvents(args);

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xybstone/macos-calendar-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server