import { BaseTool } from './base.tool.js';
export class ReadNoteTool extends BaseTool {
readonly name = 'read_note';
readonly description = 'Read the content and frontmatter of a note from the Obsidian vault';
readonly inputSchema = {
type: 'object' as const,
properties: {
path: {
type: 'string',
description: 'Path to the note (e.g., "daily/2025-01-15.md" or "projects/myproject")',
},
},
required: ['path'],
};
async execute(params: { path: string }) {
try {
const note = await this.vault.read(params.path);
return {
success: true,
note: {
path: note.path,
content: note.content,
frontmatter: note.frontmatter,
},
};
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to read note',
};
}
}
}