Skip to main content
Glama

read_note

Retrieve note content from your Obsidian vault by specifying the file path, enabling AI models to access and reference stored knowledge.

Instructions

Read the content of a note in the Obsidian vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the note within the vault

Implementation Reference

  • MCP tool handler for 'read_note' that validates the input path, reads the note content using the private readNote method, and returns it in the MCP content format.
    private async handleReadNote(args: any) { if (!args?.path) { throw new Error('Path is required'); } const content = await this.readNote(args.path); return { content: [ { type: 'text', text: content, }, ], }; }
  • Core implementation of note reading logic: attempts to fetch content via Obsidian Local REST API GET /vault/{path}, with fallback to direct filesystem fs.readFileSync if API fails or file not found.
    private async readNote(notePath: string): Promise<string> { try { // First try using the Obsidian API const response = await this.api.get(`/vault/${encodeURIComponent(notePath)}`); // API returns the content directly, not wrapped in {content: ...} return response.data || ''; } catch (error) { console.warn('API request failed, falling back to file system:', error); // Fallback to file system if API fails const fullPath = path.join(VAULT_PATH, notePath); if (fs.existsSync(fullPath)) { return fs.readFileSync(fullPath, 'utf-8'); } else { return ''; } }
  • JSON schema definition for the read_note tool input, defining the required 'path' string parameter. This is returned by the ListToolsRequestHandler.
    name: 'read_note', description: 'Read the content of a note in the Obsidian vault', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the note within the vault', }, }, required: ['path'], }, },
  • src/index.ts:1391-1391 (registration)
    Dispatch/registration case in the CallToolRequestSchema handler that routes 'read_note' tool calls to the handleReadNote method.
    return await this.handleReadNote(request.params.arguments);

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/newtype-01/obsidian-mcp'

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