createReminder
Add reminders to Apple Reminders on macOS by specifying a list name, title, due date, and optional notes for better task management.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dueDate | No | ||
| listName | Yes | ||
| notes | No | ||
| title | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"dueDate": {
"type": "string"
},
"listName": {
"type": "string"
},
"notes": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"listName",
"title"
],
"type": "object"
}
Implementation Reference
- src/index.ts:63-90 (registration)Registers the MCP tool 'createReminder' with input schema and handler function that delegates to reminders.createReminder helper.server.tool( "createReminder", { listName: z.string(), title: z.string(), dueDate: z.string().optional(), notes: z.string().optional() }, async ({ listName, title, dueDate, notes }) => { try { const success = await reminders.createReminder(listName, title, dueDate, notes); return { content: [{ type: "text", text: JSON.stringify({ success, message: success ? "Reminder created" : "Failed to create reminder" }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: "Failed to create reminder" }) }], isError: true }; } } );
- src/index.ts:65-70 (schema)Input schema for the createReminder tool using Zod validation.{ listName: z.string(), title: z.string(), dueDate: z.string().optional(), notes: z.string().optional() },
- src/index.ts:71-89 (handler)MCP tool handler for createReminder: calls the helper, formats response as MCP content.async ({ listName, title, dueDate, notes }) => { try { const success = await reminders.createReminder(listName, title, dueDate, notes); return { content: [{ type: "text", text: JSON.stringify({ success, message: success ? "Reminder created" : "Failed to create reminder" }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: "Failed to create reminder" }) }], isError: true }; } }
- src/reminders.ts:68-99 (helper)Helper function implementing the core logic: finds list by name, creates reminder using node-reminders library.export async function createReminder(listName: string, title: string, dueDate?: string, notes?: string): Promise<boolean> { 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`); } // Prepare reminder data const reminderData: any = { name: title }; if (dueDate) { reminderData.dueDate = new Date(dueDate); } if (notes) { reminderData.body = notes; } // Create the reminder const newReminderId = await reminders.createReminder(targetList.id, reminderData); return !!newReminderId; } catch (error) { console.error(`Failed to create reminder "${title}" in list "${listName}":`, error); throw new Error(`Failed to create reminder: ${error}`); } }