get_note_links
Retrieves all wikilinks contained in a specified Obsidian note. Useful for understanding internal connections within your vault.
Instructions
Get all wikilinks from a note.
Args: path: Path to the note
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- server.py:257-268 (handler)MCP tool handler that wraps the ObsidianVaultClient.get_note_links method. Decorated with @mcp.tool() to register as an MCP tool.
@mcp.tool() def get_note_links(path: str) -> list: """Get all wikilinks from a note. Args: path: Path to the note """ try: client = get_vault_client() return client.get_note_links(path) except Exception as e: return [{"error": str(e)}] - server.py:257-258 (registration)The tool is registered as an MCP tool via the @mcp.tool() decorator on the function definition.
@mcp.tool() def get_note_links(path: str) -> list: - obsidian_client.py:239-253 (helper)Helper method on ObsidianVaultClient that extracts all [[wikilink]] targets from a note's content using regex, stripping header references (e.g., [[page#section]] -> 'page').
def get_note_links(self, path: str) -> List[str]: """Extract all wikilink targets from a note.""" note = self.get_note(path) if not note: return [] content = note['content'] link_pattern = re.compile(r'\\[\\[([^\\]|]+)(?:\\|[^\\]]*)?\\]\\]') links = [] for match in link_pattern.findall(content): link_target = match.split('#')[0] # Remove header references links.append(link_target) return links