read_note
Retrieve content from Markdown notes stored in Nextcloud Notes by specifying filename and optional category, enabling access to stored information for processing.
Instructions
Read a Markdown (.md) file.
Args:
filename: Name of the note file, e.g., "note1.md"
category: Optional category folder. If None, read from /Notes root.
Returns:
Content of the note as a string.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | ||
| category | No |
Implementation Reference
- nextcloud_notes_mcp/server.py:97-116 (handler)The handler function for the 'read_note' tool. It constructs the full path to the note file in Nextcloud, downloads it to a temporary local file using WebDAV client, reads the content, cleans up the temp file, and returns the note's content as a string.@mcp.tool() def read_note(filename: str, category: str | None = None) -> str: """ Read a Markdown (.md) file. Args: filename: Name of the note file, e.g., "note1.md" category: Optional category folder. If None, read from /Notes root. Returns: Content of the note as a string. """ 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") client.download_sync(remote_path=full_path, local_path=tmp_path) with open(tmp_path, "r", encoding="utf-8") as f: content = f.read() os.remove(tmp_path) return content