zk_get_note
Retrieve a specific note from the Zettelkasten system by its ID or title, enabling quick access to stored atomic notes for knowledge management and synthesis.
Instructions
Retrieve a note by ID or title. Args: identifier: The ID or title of the note
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes |
Implementation Reference
- The main handler function for the zk_get_note tool. It attempts to retrieve the note by ID first, then by title using ZettelService, formats the metadata and content, and returns a formatted string or error message.def zk_get_note(identifier: str) -> str: """Retrieve the full content and metadata of a note by its unique ID or title. Args: identifier: The unique ID or exact title of the note to retrieve """ try: identifier = str(identifier) # Try to get by ID first note = self.zettel_service.get_note(identifier) # If not found, try by title if not note: note = self.zettel_service.get_note_by_title(identifier) if not note: return f"Note not found: {identifier}" # Format the note result = f"# {note.title}\n" result += f"ID: {note.id}\n" result += f"Type: {note.note_type.value}\n" result += f"Created: {note.created_at.isoformat()}\n" result += f"Updated: {note.updated_at.isoformat()}\n" if note.tags: result += f"Tags: {', '.join(tag.name for tag in note.tags)}\n" # Add note content, including the Links section added by _note_to_markdown() result += f"\n{note.content}\n" return result except Exception as e: return self.format_error_response(e)
- src/zettelkasten_mcp/server/mcp_server.py:156-164 (registration)The @mcp.tool decorator that registers the zk_get_note function as an MCP tool, specifying its name, description, and annotations indicating it's read-only and idempotent.@self.mcp.tool( name="zk_get_note", description="Retrieve the full content and metadata of a note by its unique ID or title.", annotations={ "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, }, )
- src/zettelkasten_mcp/server/mcp_server.py:195-195 (registration)Debug log confirming the registration of the zk_get_note tool.logger.debug("Tool zk_get_note registered")