-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Problem
When using noteplan_manage_note move to relocate a note to a different folder, the note's _attachments directory is left behind in the original location. This silently breaks all embedded images and file references in the moved note.
The same gap exists for rename (the _attachments folder name derives from the note filename, so it becomes disconnected) and delete (the _attachments folder is left behind when the note is trashed).
How encountered:
While reorganizing a NotePlan library via the MCP — moving notes from subfolders to other folders. After moving ~26 notes, NotePlan's sidebar still showed the now-empty subfolder tree. Investigating on disk found:
- Empty parent directories (the MCP moves the file but doesn't clean up empty dirs)
- Orphaned
_attachmentsfolders with images/files still in the old location - Broken
links in the moved notes (relative paths no longer resolve)
Fixed manually by moving _attachments folders via the shell and removing empty directories with rmdir.
Suspected root cause
In src/noteplan/file-writer.ts, moveLocalNote() calls moveFile() on the single .md file only. The _attachments sibling directory is not considered. Same pattern in renameLocalNoteFile() and deleteNote().
The attachment path logic already exists in attachments.ts (getAttachmentsFolderPath()), it's just not referenced during note-level file operations.
Suggested fix
In file-writer.ts, after each note file operation, also handle the _attachments folder:
-
moveLocalNote()** — after moving the .md, move{noteName}_attachments/to the destination: -
renameLocalNoteFile()** — rename the_attachmentsfolder AND rewrite attachment links in note content -
deleteNote()** — move_attachments/to@Trashalongside the note. -
Optional:**
moveLocalNote()could also clean up empty parent directories after moving, since the MCP'sfolders.deleteaction exists but users might not expect to need it after moving out the last note. Less sure about that, we don't have a .keep equivalent here I know of and some might want to keep the folder with no content, others not.
Environment
- noteplan-mcp v1.1.15
- NotePlan 3 (SetApp)
- Using CloudKit sync
- M3 Max MBP on macOS 26.3.1
Thanks for a great MCP server — this was the only hiccup in an otherwise seamless reorganization of ~200 notes. Happy to submit a PR if that's preferred.