getReminders
Retrieve reminders from a specific Apple Reminders list to help users view and manage their tasks through AI assistants.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listName | Yes |
Implementation Reference
- src/index.ts:41-59 (handler)The handler function for the 'getReminders' MCP tool. It takes a listName parameter, fetches reminders using the helper, handles errors, and returns JSON-formatted reminders in MCP response format.async ({ listName }) => { try { const items = await reminders.getRemindersFromList(listName); return { content: [{ type: "text", text: JSON.stringify({ reminders: items }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: `Failed to get reminders from list: ${listName}` }) }], isError: true }; } }
- src/index.ts:40-40 (schema)Input schema for the getReminders tool using Zod, requiring a 'listName' string parameter.{ listName: z.string() },
- src/index.ts:38-59 (registration)Registration of the 'getReminders' tool on the MCP server, specifying name, input schema, and handler function.server.tool( "getReminders", { listName: z.string() }, async ({ listName }) => { try { const items = await reminders.getRemindersFromList(listName); return { content: [{ type: "text", text: JSON.stringify({ reminders: items }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: `Failed to get reminders from list: ${listName}` }) }], isError: true }; } }
- src/reminders.ts:35-63 (helper)Supporting helper function that retrieves reminders from a specific list: finds list by name, calls node-reminders.getReminders, formats the output.export async function getRemindersFromList(listName: string): Promise<any[]> { try { // First get the list ID by name const lists = await reminders.getLists(); const targetList = lists.find(list => list.name === listName); if (!targetList) { throw new Error(`List "${listName}" not found`); } // Get reminders from the list with specific properties const reminderItems = await reminders.getReminders( targetList.id, ['name', 'completed', 'dueDate', 'priority', 'body'] ); // Format the reminders to match the expected output format return reminderItems.map(item => ({ name: item.name, completed: item.completed || false, dueDate: formatDate(item.dueDate), priority: item.priority || 0, notes: item.body })); } catch (error) { console.error(`Failed to get reminders from list "${listName}":`, error); throw new Error(`Failed to get reminders from list "${listName}": ${error}`); } }