There was an error while loading. Please reload this page.
1 parent 795e339 commit 73202d1Copy full SHA for 73202d1
2 files changed
src/basic_memory/mcp/tools/write_note.py
@@ -63,7 +63,8 @@ async def write_note(
63
title: The title of the note
64
content: Markdown content for the note, can include observations and relations
65
folder: Folder path relative to project root where the file should be saved.
66
- Use forward slashes (/) as separators. Examples: "notes", "projects/2025", "research/ml"
+ Use forward slashes (/) as separators. Use "/" or "" to write to project root.
67
+ Examples: "notes", "projects/2025", "research/ml", "/" (root)
68
project: Project name to write to. Optional - server will resolve using the
69
hierarchy above. If unknown, use list_memory_projects() to discover
70
available projects.
@@ -124,6 +125,10 @@ async def write_note(
124
125
# Get and validate the project (supports optional project parameter)
126
active_project = await get_active_project(client, project, context)
127
128
+ # Normalize "/" to empty string for root folder (must happen before validation)
129
+ if folder == "/":
130
+ folder = ""
131
+
132
# Validate folder path to prevent path traversal attacks
133
project_path = active_project.home
134
if folder and not validate_project_path(folder, project_path):
test-int/mcp/test_write_note_integration.py
@@ -397,6 +397,7 @@ async def test_write_note_file_path_os_path_join(mcp_server, test_project):
397
"nested/folder/another-note",
398
),
399
("", "Root Note", "root-note.md", "root-note"),
400
+ ("/", "Root Slash Note", "root-slash-note.md", "root-slash-note"),
401
(
402
"folder with spaces",
403
"Note Title",
0 commit comments