read_note
Retrieve content from Obsidian notes by specifying the note path within your vault.
Instructions
Obsidianノートの内容を読み込みます
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notePath | Yes | ノートのパス(vault相対パス) |
Implementation Reference
- src/obsidian-handler.ts:56-68 (handler)The core handler function that validates the note path, checks if the file exists in the Obsidian vault, reads the file content using fs.readFile, and returns it as a string.async readNote(notePath: string): Promise<string> { if (!FileUtils.validatePath(this.config.vaultPath, notePath)) { throw new Error('無効なファイルパスです'); } const fullPath = path.join(this.config.vaultPath, notePath); if (!(await FileUtils.fileExists(fullPath))) { throw new Error(`ノート '${notePath}' が見つかりません`); } return await fs.readFile(fullPath, 'utf-8'); }
- src/server.ts:91-100 (schema)Input schema definition for the 'read_note' tool, requiring a 'notePath' string parameter describing the vault-relative path to the note.inputSchema: { type: 'object', properties: { notePath: { type: 'string', description: 'ノートのパス(vault相対パス)', }, }, required: ['notePath'], },
- src/server.ts:88-100 (registration)Registration of the 'read_note' tool in the ListTools response, including name, description, and input schema.{ name: 'read_note', description: 'Obsidianノートの内容を読み込みます', inputSchema: { type: 'object', properties: { notePath: { type: 'string', description: 'ノートのパス(vault相対パス)', }, }, required: ['notePath'], },
- src/server.ts:281-285 (registration)Dispatch handler in the CallToolRequest switch statement that invokes the obsidianHandler.readNote method and formats the response as MCP content.case 'read_note': const noteContent = await this.obsidianHandler.readNote(args.notePath as string); return { content: [{ type: 'text', text: noteContent }], };