Skip to main content
Glama
pmmvr

Obsidian MCP Server

by pmmvr

get_note_content

Retrieve the full content and metadata of a specific note by its path within an Obsidian vault, enabling efficient data access and analysis for AI-driven workflows.

Instructions

Get the full content and metadata of a specific note by path.

Args:
    path: Full path to the note within the vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The main handler function for the 'get_note_content' tool. It retrieves the note's metadata and content by calling the Obsidian client's get_note_metadata method, handling success and error cases.
    async def get_note_content(path: str) -> Dict[str, Any]:
        """
        Get the full content and metadata of a specific note by path.
        
        Args:
            path: Full path to the note within the vault
        """
        try:
            note_data = await client.get_note_metadata(path)
            return {
                "success": True,
                "data": note_data
            }
        except Exception as e:
            return {
                "success": False,
                "error": f"Failed to get note at path '{path}': {str(e)}",
                "data": None
            }
  • Registers the 'get_note_content' tool with the FastMCP server, providing metadata annotations like title and read-only hints.
    @mcp.tool(
        annotations={
            "title": "Get Obsidian Note Content",
            "readOnlyHint": True,
            "openWorldHint": False
        }
    )
  • Helper method in ObsidianClient that performs the HTTP GET request to fetch note metadata from the Obsidian API.
    async def get_note_metadata(self, path: str) -> Dict[str, Any]:
        encoded_path = quote(path, safe='/')
        return await self._request(
            "GET", 
            f"/vault/{encoded_path}",
            headers={"Accept": "application/vnd.olrapi.note+json"}
        )
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pmmvr/obsidian-api-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server