create-note
Add a note to Apple Notes with a title and markdown content. Optionally organize by placing it in a specific folder path.
Instructions
Create a new Apple Note with a title and markdown content. Optionally place it in a folder path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| content | Yes | Note content in markdown format | |
| folder | No | Optional folder path to create the note in (e.g. iCloud/Work/Projects). Use list-folders to get available paths. |
Implementation Reference
- index.ts:889-897 (handler)Request handler for create-note - parses args, calls createNote, re-indexes, returns response
if (name === "create-note") { const { title, content, folder } = CreateNoteSchema.parse(args); const noteId = await createNote(title, markdownToHtml(content), folder); const note = await refreshIndexedNoteById(notesTable, noteId); return createJsonResponse({ ok: true, data: note, message: `Created note "${title}"${folder ? ` in ${folder}` : ""}.`, }); - index.ts:751-770 (helper)Actual implementation that uses JXA (AppleScript) to create a macOS Apple Note with title, HTML body, and optional folder
const createNote = async (title: string, content: string, folder?: string) => { const result = await verboseRunJxa( `${jxaGetFolderPath} const app = Application('Notes'); const targetPath = args[2]; const note = app.make({new: 'note', withProperties: { name: args[0], body: args[1] }}); if (targetPath) { const allFolders = Array.from(app.folders()); const targetFolder = allFolders.find(f => getFolderPath(f) + '/' + f.name() === targetPath); if (!targetFolder) throw new Error('__FOLDER_NOT_FOUND__:' + targetPath); app.move(note, {to: targetFolder}); } return note.id();`, [title, content, folder || ""] ); return result as string; }; - index.ts:1063-1067 (schema)Zod schema defining the input shape for create-note: title (required), content (required), folder (optional)
const CreateNoteSchema = z.object({ title: z.string(), content: z.string(), folder: z.string().optional(), }); - index.ts:258-278 (registration)Tool registration in ListToolsRequestSchema handler, defining the tool name, description, and JSON schema input
{ name: "create-note", description: "Create a new Apple Note with a title and markdown content. Optionally place it in a folder path.", inputSchema: { type: "object", properties: { title: { type: "string" }, content: { type: "string", description: "Note content in markdown format", }, folder: { type: "string", description: "Optional folder path to create the note in (e.g. iCloud/Work/Projects). Use list-folders to get available paths.", }, }, required: ["title", "content"], }, }, - index.ts:33-35 (helper)Converts markdown content to HTML before passing to the Apple Notes JXA API
const { turndown } = new TurndownService(); const markdownToHtml = (md: string) => marked(md, { async: false }) as string; const db = await lancedb.connect(path.join(os.homedir(), ".mcp-apple-notes", "data"));