getCalendars
Retrieve and list available Apple Calendar calendars on macOS through the MCP server interface for accessing calendar data.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "getCalendars"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:15-37 (handler)MCP tool handler for 'getCalendars': calls the calendars.getCalendars() helper, formats response as MCP content with error handling.
server.tool( "getCalendars", {}, async () => { try { const calendarList = await calendars.getCalendars(); return { content: [{ type: "text", text: JSON.stringify({ calendars: calendarList }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: "Failed to get calendars" }) }], isError: true }; } } ); - src/calendars.ts:57-67 (helper)Core helper function that performs the HTTP GET request to the Calendar API Bridge endpoint `/calendars` to retrieve all calendars.
* Get all calendars */ export async function getCalendars(): Promise<any[]> { try { const response = await axios.get(`${API_BASE_URL}/calendars`); return response.data; } catch (error) { console.error('Failed to get calendars:', error); throw new Error(`Failed to get calendars: ${error}`); } } - src/index.ts:17-17 (schema)Empty Zod schema indicating 'getCalendars' tool takes no input parameters.
{}, - src/index.ts:15-15 (registration)Registration of the 'getCalendars' tool using McpServer.tool() method.
server.tool(