Read Note
read_noteRetrieve the full text of any note using its unique ID. Access stored note content directly from Apple Notes.
Instructions
Read the full content of a specific note by its ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Note ID (x-coredata:// format) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| name | Yes | ||
| body | Yes | ||
| plaintext | Yes | ||
| creationDate | Yes | ||
| modificationDate | Yes | ||
| folder | Yes | ||
| shared | Yes | ||
| passwordProtected | Yes |
Implementation Reference
- src/notes/tools.ts:234-243 (handler)The handler function for the 'read_note' tool. It receives the note ID, executes the JXA script (readNoteScript) to retrieve note details, checks shared access via guardSharedAccess, and returns the note data as untrusted structured output.
async ({ id }) => { try { const result = await runJxa<NoteDetail>(readNoteScript(id)); const blocked = await guardSharedAccess(result.shared, config, "notes", "read_note", { id }); if (blocked) return errPermission(blocked); return okUntrustedStructured(result); } catch (e) { return errJxaFor("read note", e); } }, - src/notes/tools.ts:213-226 (schema)Input/output schema and metadata for 'read_note'. Input requires an 'id' string; output includes id, name, body, plaintext, creationDate, modificationDate, folder, shared, and passwordProtected booleans.
inputSchema: { id: z.string().max(500).describe("Note ID (x-coredata:// format)"), }, outputSchema: { id: z.string(), name: z.string(), body: z.string(), plaintext: z.string(), creationDate: z.string(), modificationDate: z.string(), folder: z.string(), shared: z.boolean(), passwordProtected: z.boolean(), }, - src/notes/tools.ts:208-244 (registration)Registration of the 'read_note' tool via server.registerTool with its schema, annotations, and handler callback.
server.registerTool( "read_note", { title: "Read Note", description: "Read the full content of a specific note by its ID. Returns HTML body and plaintext.", inputSchema: { id: z.string().max(500).describe("Note ID (x-coredata:// format)"), }, outputSchema: { id: z.string(), name: z.string(), body: z.string(), plaintext: z.string(), creationDate: z.string(), modificationDate: z.string(), folder: z.string(), shared: z.boolean(), passwordProtected: z.boolean(), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async ({ id }) => { try { const result = await runJxa<NoteDetail>(readNoteScript(id)); const blocked = await guardSharedAccess(result.shared, config, "notes", "read_note", { id }); if (blocked) return errPermission(blocked); return okUntrustedStructured(result); } catch (e) { return errJxaFor("read note", e); } }, ); - src/notes/scripts.ts:121-137 (helper)The readNoteScript function that generates a JXA (JavaScript for Automation) script string. This script uses Apple's Notes application to find a note by ID and returns its id, name, body, plaintext, creationDate, modificationDate, folder, shared, and passwordProtected fields as JSON.
export function readNoteScript(id: string): string { return ` const Notes = Application('Notes'); const note = Notes.notes.byId('${esc(id)}'); JSON.stringify({ id: note.id(), name: note.name(), body: note.body(), plaintext: note.plaintext(), creationDate: note.creationDate().toISOString(), modificationDate: note.modificationDate().toISOString(), folder: note.container().name(), shared: note.shared(), passwordProtected: note.passwordProtected() }); `; }