edit_note
Update content in Markdown (.md) files stored in Nextcloud Notes by specifying filename and new text, replacing existing content.
Instructions
Edit a Markdown (.md) file, updating its content. Always overwrites the old file.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | ||
| new_content | Yes | ||
| category | No |
Implementation Reference
- nextcloud_notes_mcp/server.py:118-137 (handler)The 'edit_note' tool handler. Decorated with @mcp.tool() to register it with the MCP server. Downloads to temp, overwrites remote file via WebDAV, uploads new content.@mcp.tool() def edit_note(filename: str, new_content: str, category: str | None = None) -> str: """ Edit a Markdown (.md) file, updating its content. Always overwrites the old file. """ full_path = f"/Notes/{category}/{filename}" if category else f"/Notes/{filename}" tmp_path = os.path.join(tempfile.gettempdir(), next(tempfile._get_candidate_names()) + ".tmp") with open(tmp_path, "w", encoding="utf-8") as f: f.write(new_content) # Remove existing file if it exists if client.check(remote_path=full_path): client.clean(remote_path=full_path) # Upload new content client.upload_sync(remote_path=full_path, local_path=tmp_path) os.remove(tmp_path) return f"Note updated successfully: {full_path}"
- nextcloud_notes_mcp/server.py:118-118 (registration)Registration of the 'edit_note' tool using the FastMCP decorator.@mcp.tool()