list-notes
List Apple Notes by folder path, retrieving title, path, and timestamps. Optionally include note content for complete access to your notes data.
Instructions
List Apple Notes with title, path, and timestamps. Optionally filter by folder path and include note content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Optional folder path to filter notes (e.g. iCloud/Work/Projects). Use list-folders to get available paths. | |
| includeContent | No | If true, include note content in the response (default: false) |
Implementation Reference
- index.ts:898-903 (handler)Handler that dispatches 'list-notes' tool calls. Parses args with ListNotesSchema, then either filters by folder path (via getNotesByPath) or returns all indexed notes (via getIndexedNotes).
} else if (name === "list-notes") { const { path, includeContent } = ListNotesSchema.parse(args); const notes = path ? await getNotesByPath(path, includeContent) : await getIndexedNotes(notesTable, includeContent); return createJsonResponse({ ok: true, data: notes }); - index.ts:90-93 (schema)Zod schema for list-notes input validation: optional 'path' folder filter and optional 'includeContent' boolean.
const ListNotesSchema = z.object({ path: z.string().optional(), includeContent: z.boolean().optional(), }); - index.ts:202-221 (registration)Tool registration within the ListToolsRequestSchema handler, defining the tool name, description, and input schema for the MCP server.
{ name: "list-notes", description: "List Apple Notes with title, path, and timestamps. Optionally filter by folder path and include note content.", inputSchema: { type: "object", properties: { path: { type: "string", description: "Optional folder path to filter notes (e.g. iCloud/Work/Projects). Use list-folders to get available paths.", }, includeContent: { type: "boolean", description: "If true, include note content in the response (default: false)", }, }, required: [], }, }, - index.ts:568-600 (helper)Helper that uses JXA (JavaScript for Automation) to query Apple Notes by folder path, returning note metadata and optionally content.
const getNotesByPath = async (folderPath: string, includeContent = false) => { const result = await verboseRunJxa( `${jxaGetFolderPath} const app = Application('Notes'); app.includeStandardAdditions = true; const targetPath = args[0]; const withContent = args[1] === 'true'; const allFolders = Array.from(app.folders()); const folder = allFolders.find(f => getFolderPath(f) + '/' + f.name() === targetPath); if (!folder) return JSON.stringify([]); const notes = Array.from(folder.notes()); return JSON.stringify(notes.map(note => { const base = { id: note.id(), title: note.name(), path: targetPath, creation_date: note.creationDate().toLocaleString(), modification_date: note.modificationDate().toLocaleString() }; if (withContent) base.content = note.body(); return base; }));`, [folderPath, String(includeContent)] ); return JSON.parse(result as string) as { id: string; title: string; path: string; creation_date: string; modification_date: string; content?: string; }[]; - index.ts:412-422 (helper)Helper that returns all notes from the local LanceDB index, optionally including content.
export const getIndexedNotes = async (notesTable: lancedb.Table, includeContent = false) => { const rows = await notesTable.query().toArray(); return rows.map((row: any) => ({ id: row.id, title: row.title, path: row.path, creation_date: row.creation_date, modification_date: row.modification_date, ...(includeContent ? { content: row.content } : {}), })); };