get_note
Retrieve Apple Notes content as Markdown by specifying a note title, with optional folder filtering to locate specific notes.
Instructions
Get the full content of a note by its title, returned as Markdown. Optionally specify folder to disambiguate.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Note title (exact match) | |
| folder | No | Folder name to scope the search |
Implementation Reference
- src/index.ts:66-86 (handler)Tool registration and handler implementation for "get_note". It calls the `getNoteBody` function from `applescript.ts`.
server.tool( "get_note", "Get the full content of a note by its title, returned as Markdown. Optionally specify folder to disambiguate.", { title: z.string().describe("Note title (exact match)"), folder: z.string().optional().describe("Folder name to scope the search"), }, async ({ title, folder }) => { try { const body = await getNoteBody(title, folder); return { content: [{ type: "text", text: body }], }; } catch (e: unknown) { return { content: [{ type: "text", text: `Error: ${(e as Error).message}` }], isError: true, }; } } ); - src/applescript.ts:27-44 (handler)Actual implementation of the `getNoteBody` function which runs the AppleScript to retrieve and convert note content from Apple Notes.
export async function getNoteBody(title: string, folder?: string): Promise<string> { const folderClause = folder ? `of folder ${JSON.stringify(folder)}` : ""; // Try to find by exact title; if folder is given, scope to that folder const script = ` tell application "Notes" set matchedNotes to (every note ${folderClause} whose name is ${JSON.stringify(title)}) if (count of matchedNotes) = 0 then error "Note not found: ${title.replace(/"/g, '\\"')}" end if return body of item 1 of matchedNotes end tell `; const html = await runAppleScript(script); return turndown.turndown(html); }