apple-notes-mcp 2.5.6 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js
CHANGED
|
@@ -1136,10 +1136,7 @@ server.registerTool("batch-delete-notes", {
|
|
|
1136
1136
|
server.registerTool("batch-move-notes", {
|
|
1137
1137
|
description: "Use when: moving multiple notes by id into one destination folder.\nReturns: per-id success/failure counts.\nDo not use when: moving a single note (move-note).\nNote: the destination folder must already exist (create-folder).",
|
|
1138
1138
|
inputSchema: {
|
|
1139
|
-
ids: z
|
|
1140
|
-
.array(z.string().max(MAX.ID))
|
|
1141
|
-
.max(MAX.BATCH_IDS)
|
|
1142
|
-
.describe("Array of note IDs to move"),
|
|
1139
|
+
ids: z.array(z.string().max(MAX.ID)).max(MAX.BATCH_IDS).describe("Array of note IDs to move"),
|
|
1143
1140
|
folder: z.string().max(MAX.FOLDER).describe("Destination folder name"),
|
|
1144
1141
|
account: z
|
|
1145
1142
|
.string()
|
|
@@ -585,8 +585,13 @@ export class AppleNotesManager {
|
|
|
585
585
|
console.error(`Failed to create note "${title}":`, result.error);
|
|
586
586
|
return null;
|
|
587
587
|
}
|
|
588
|
-
// Extract the CoreData ID from the response
|
|
589
|
-
|
|
588
|
+
// Extract the CoreData ID from the response.
|
|
589
|
+
// AppleScript's `id of newNote` yields an object specifier of the form
|
|
590
|
+
// "note id x-coredata://<uuid>/ICNote/pN" — with a literal "note id " prefix.
|
|
591
|
+
// Strip that prefix so we return the bare x-coredata:// URL that the id
|
|
592
|
+
// validator and downstream tools (get-note-content, update-note) accept.
|
|
593
|
+
const rawOutput = result.output.trim();
|
|
594
|
+
const noteId = extractCoreDataId(rawOutput, "note") || rawOutput;
|
|
590
595
|
// Return a Note object representing the created note with real ID
|
|
591
596
|
const now = new Date();
|
|
592
597
|
return {
|
|
@@ -341,6 +341,33 @@ describe("AppleNotesManager", () => {
|
|
|
341
341
|
expect(result?.content).toBe("Eggs, Milk, Bread");
|
|
342
342
|
expect(result?.account).toBe("iCloud"); // Default account
|
|
343
343
|
});
|
|
344
|
+
it("strips the 'note id ' prefix from the returned id (#create-note-id)", () => {
|
|
345
|
+
// AppleScript's `id of newNote` yields an object specifier with a literal
|
|
346
|
+
// "note id " prefix. The returned id must be the bare x-coredata:// URL so
|
|
347
|
+
// downstream tools (get-note-content, update-note) accept it.
|
|
348
|
+
mockExecuteAppleScript.mockReturnValue({
|
|
349
|
+
success: true,
|
|
350
|
+
output: "note id x-coredata://ABC-DEF/ICNote/p42",
|
|
351
|
+
});
|
|
352
|
+
const result = manager.createNote("Prefixed", "Body");
|
|
353
|
+
expect(result?.id).toBe("x-coredata://ABC-DEF/ICNote/p42");
|
|
354
|
+
expect(result?.id).not.toMatch(/^note id /);
|
|
355
|
+
});
|
|
356
|
+
it("returned id round-trips through get-note-content and update-note (#create-note-id)", () => {
|
|
357
|
+
mockExecuteAppleScript.mockReturnValue({
|
|
358
|
+
success: true,
|
|
359
|
+
output: "note id x-coredata://ABC-DEF/ICNote/p99",
|
|
360
|
+
});
|
|
361
|
+
const created = manager.createNote("Roundtrip", "Body");
|
|
362
|
+
const id = created?.id;
|
|
363
|
+
expect(id).toBe("x-coredata://ABC-DEF/ICNote/p99");
|
|
364
|
+
// Reading back by the returned id must not throw "Invalid note ID format".
|
|
365
|
+
mockExecuteAppleScript.mockReturnValue({ success: true, output: "Body text" });
|
|
366
|
+
expect(() => manager.getNoteContentById(id)).not.toThrow();
|
|
367
|
+
// Updating by the returned id must not throw either.
|
|
368
|
+
mockExecuteAppleScript.mockReturnValue({ success: true, output: "" });
|
|
369
|
+
expect(() => manager.updateNoteById(id, undefined, "New body")).not.toThrow();
|
|
370
|
+
});
|
|
344
371
|
it("returns null when AppleScript fails", () => {
|
|
345
372
|
mockExecuteAppleScript.mockReturnValue({
|
|
346
373
|
success: false,
|
package/package.json
CHANGED