get_note
Retrieve a note from an Obsidian vault by providing its path relative to the vault root.
Instructions
Get a note by its path.
Args: path: Path to the note relative to vault root (e.g., "notes/my-note.md")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- server.py:87-103 (handler)MCP tool handler for 'get_note'. Decorated with @mcp.tool(), receives a path parameter, gets the vault client, calls client.get_note(path), and returns the note dict or an error.
@mcp.tool() def get_note(path: str) -> dict: """Get a note by its path. Args: path: Path to the note relative to vault root (e.g., "notes/my-note.md") """ try: client = get_vault_client() note = client.get_note(path) if note is None: return {"error": f"Note not found: {path}"} return note except Exception as e: return {"error": str(e)} - obsidian_client.py:96-116 (helper)ObsidianVaultClient.get_note() - core implementation. Resolves the vault-relative path, loads markdown content and frontmatter, normalizes tags, and returns a dict with path, content, metadata, title, tags, created, modified.
def get_note(self, path: str) -> Optional[Dict[str, Any]]: """Get a note by path.""" note_path = self._resolve_vault_path(path) if not note_path.exists() or not note_path.suffix.lower() == '.md': return None try: content, metadata = self._load_markdown(note_path) tags = sorted(set(self._normalize_tags(metadata.get('tags')) + self._extract_inline_tags(content))) return { 'path': str(note_path.relative_to(self.vault_path)), 'content': content, 'metadata': metadata, 'title': metadata.get('title', note_path.stem), 'tags': tags, 'created': metadata.get('created'), 'modified': metadata.get('modified') } except Exception as e: raise RuntimeError(f"Error reading note {path}: {str(e)}") - server.py:87-88 (registration)Tool registration via the @mcp.tool() decorator on the get_note function. FastMCP registers this as an MCP tool named 'get_note'.
@mcp.tool() def get_note(path: str) -> dict: - server.py:88-93 (schema)Type signature for get_note: takes a single 'path' parameter of type str, returns a dict. The docstring describes the expected input format.
def get_note(path: str) -> dict: """Get a note by its path. Args: path: Path to the note relative to vault root (e.g., "notes/my-note.md") """