list-folders
List all Apple Notes folders with full paths and note counts to organize and navigate your notes efficiently.
Instructions
List all Apple Notes folders with full paths and note counts
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.ts:926-928 (handler)Handler logic for 'list-folders' tool: calls getFolders() and returns the folder data.
} else if (name === "list-folders") { const folders = await getFolders(); return createJsonResponse({ ok: true, data: folders }); - index.ts:552-566 (helper)The getFolders() helper function executed by the handler. Uses JXA (AppleScript) to query Apple Notes folders and return their name, path, and noteCount.
const getFolders = async () => { const result = await verboseRunJxa(` ${jxaGetFolderPath} const app = Application('Notes'); app.includeStandardAdditions = true; const folders = Array.from(app.folders()); return JSON.stringify(folders.map(f => ({ name: f.name(), path: getFolderPath(f) + '/' + f.name(), noteCount: f.notes().length }))); `); return JSON.parse(result as string) as { name: string; path: string; noteCount: number }[]; }; - index.ts:193-201 (registration)Tool registration metadata: declares the 'list-folders' tool with its name, description, and empty inputSchema (no parameters required).
{ name: "list-folders", description: "List all Apple Notes folders with full paths and note counts", inputSchema: { type: "object", properties: {}, required: [], }, }, - index.ts:376-394 (helper)Shared JXA helper used by getFolders() to construct full folder paths by walking up the container hierarchy.
const jxaGetFolderPath = ` function getFolderPath(item) { var parts = []; var current = item; while (true) { try { var c = current.container(); parts.unshift(c.name()); current = c; } catch(e) { break; } } return parts.join('/'); } function getNoteFolderPath(note) { var folder = note.container(); return getFolderPath(folder) + '/' + folder.name(); } `;