getCalendarEvents
Fetch events from a specified Apple Calendar using the calendar ID. Enables structured access to calendar data via the MCP Apple Calendars server for macOS.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"calendarId": {
"type": "string"
}
},
"required": [
"calendarId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:40-62 (registration)MCP server tool registration for 'getCalendarEvents', including input schema { calendarId: z.string() } and handler function that delegates to calendars.getCalendarEvents and formats MCP response.server.tool( "getCalendarEvents", { calendarId: z.string() }, async ({ calendarId }) => { try { const events = await calendars.getCalendarEvents(calendarId); return { content: [{ type: "text", text: JSON.stringify({ events }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: `Failed to get events from calendar: ${calendarId}` }) }], isError: true }; } } );
- src/calendars.ts:85-93 (handler)Core handler function that executes the logic to fetch calendar events via HTTP request to the local Calendar API Bridge.export async function getCalendarEvents(calendarId: string): Promise<any[]> { try { const response = await axios.get(`${API_BASE_URL}/calendars/${calendarId}/events`); return response.data; } catch (error) { console.error(`Failed to get events from calendar "${calendarId}":`, error); throw new Error(`Failed to get calendar events: ${error}`); } }
- src/index.ts:42-42 (schema)Input schema validation using Zod for the calendarId parameter.{ calendarId: z.string() },