delete-note
Delete an Apple Note by moving it to Recently Deleted. Identify the note by noteId or title, and use the optional folder path to disambiguate duplicate titles.
Instructions
Delete an Apple Note (moves to Recently Deleted). Identify note by noteId or title.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | No | Apple Notes ID. If provided, skips title resolution. | |
| title | No | Title of the note to delete | |
| path | No | Optional folder path to disambiguate duplicate titles |
Implementation Reference
- index.ts:808-820 (handler)The actual delete-note handler function. It uses JXA (JavaScript for Automation) to find the note by ID in Apple Notes and calls app.delete() to move it to Recently Deleted.
const deleteNote = async (noteId: string) => { await verboseRunJxa( `const app = Application('Notes'); const noteId = args[0]; const note = Array.from(app.notes()).find(note => { return note.id() === noteId; }); if (!note) throw new Error('__NOTE_NOT_FOUND__:' + noteId); app.delete(note); return true;`, [noteId] ); }; - index.ts:114-120 (schema)Zod schema for delete-note input validation. Accepts optional noteId, title, and path strings; requires at least noteId or title.
const DeleteNoteSchema = z .object({ noteId: z.string().optional(), title: z.string().optional(), path: z.string().optional(), }) .refine((d) => d.noteId || d.title, { message: "Either noteId or title must be provided" }); - index.ts:352-371 (registration)Tool registration in the list of all tools. The delete-note tool is defined with name 'delete-note', description, and input schema referencing noteId, title, and path.
{ name: "delete-note", description: "Delete an Apple Note (moves to Recently Deleted). Identify note by noteId or title.", inputSchema: { type: "object", properties: { noteId: { type: "string", description: "Apple Notes ID. If provided, skips title resolution.", }, title: { type: "string", description: "Title of the note to delete" }, path: { type: "string", description: "Optional folder path to disambiguate duplicate titles", }, }, required: [], }, }, - index.ts:984-993 (handler)The CallToolRequestSchema handler that dispatches to deleteNote. It parses args with DeleteNoteSchema, resolves the note via resolveNoteId, calls deleteNote to delete it, removes it from the index, and returns a success response.
} else if (name === "delete-note") { const { noteId, title, path } = DeleteNoteSchema.parse(args); const { note: resolvedNote } = await resolveNoteId(notesTable, noteId, title, path); await deleteNote(resolvedNote.id); await removeIndexedNoteById(notesTable, resolvedNote.id); return createJsonResponse({ ok: true, data: { id: resolvedNote.id, title: resolvedNote.title, path: resolvedNote.path }, message: `Deleted note "${resolvedNote.title}".`, }); - index.ts:17-23 (registration)Registration in the MUTATING_TOOLS set, which controls whether the tool is available in read-only mode.
const MUTATING_TOOLS = new Set([ "create-note", "edit-note", "append-to-note", "move-note", "delete-note", ]);