read_note
Retrieve and read the content of specific notes within an Obsidian vault using the MCP server. Input a note path to access its entire text for integration or analysis.
Instructions
Read the content of a note in the Obsidian vault
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the note within the vault |
Implementation Reference
- src/index.ts:2201-2219 (handler)Core handler implementation for reading note content: attempts Obsidian Local REST API GET /vault/{path}, falls back 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 ''; } } }
- src/index.ts:1442-1457 (handler)Direct tool handler for 'read_note': validates path argument, calls core readNote, wraps response in 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, }, ], }; }
- src/index.ts:1132-1144 (schema)Input schema definition for read_note tool: requires 'path' string parameter.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)Tool registration in CallToolRequestSchema handler switch statement: dispatches to handleReadNote.return await this.handleReadNote(request.params.arguments);