Skip to main content
Glama

get_note

Retrieve notes from your Obsidian vault by specifying the vault name and file path to access specific documents and their content.

Instructions

Get a note by its path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the note
vaultYesVault name

Implementation Reference

  • src/index.ts:66-77 (registration)
    Registration of the 'get_note' MCP tool, including name, description, and input schema definition.
    { name: 'get_note', description: 'Get a note by its path', inputSchema: { type: 'object', properties: { vault: { type: 'string', description: 'Vault name' }, path: { type: 'string', description: 'Path to the note' }, }, required: ['vault', 'path'], }, },
  • Handler for the 'get_note' tool: retrieves the connector for the specified vault and calls its getNote method with the path, returning the JSON-stringified result.
    case 'get_note': { const connector = this.connectors.get(args?.vault as string); if (!connector) { throw new Error(`Vault "${args?.vault}" not found`); } const result = await connector.getNote(args?.path as string); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • LocalConnector implementation of getNote: reads the Markdown file from disk, parses it into a Note object using parseNote, adds backlinks from cache, and caches the result.
    async getNote(notePath: string): Promise<VaultOperationResult<Note>> { try { const fullPath = path.join(this.config.path!, notePath); const content = await fs.readFile(fullPath, 'utf-8'); const stats = await fs.stat(fullPath); const note = parseNote(notePath, content, stats); // Add backlinks note.backlinks = this.getBacklinks(notePath); // Update cache this.notesCache.set(notePath, note); return { success: true, data: note }; } catch (error) { return { success: false, error: `Failed to get note: ${error instanceof Error ? error.message : String(error)}` }; } }
  • RemoteConnector implementation of getNote: checks cache first, otherwise fetches note content via HTTP API, parses into Note, and caches.
    async getNote(path: string): Promise<VaultOperationResult<Note>> { try { // Try cache first if (this.notesCache.has(path)) { return { success: true, data: this.notesCache.get(path)! }; } // Fetch from remote const response = await this.client.get(`/vault/${encodeURIComponent(path)}`); const content = response.data.content || response.data; const note = parseNote(path, content); this.notesCache.set(path, note); return { success: true, data: note }; } catch (error) { return { success: false, error: `Failed to get note: ${error instanceof Error ? error.message : String(error)}` }; } }

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/bazylhorsey/obsidian-mcp-server'

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