get_note
Read note content from an Obsidian vault by specifying its file path to access and review information stored in your knowledge base.
Instructions
Read the full content of a note by its path
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Relative path to the note within the vault |
Implementation Reference
- src/tools/read.ts:76-123 (handler)The get_note tool handler is defined and registered in src/tools/read.ts. It calls readNote to fetch the file contents, parses frontmatter, and formats the response.
server.registerTool( "get_note", { description: "Read the full content of a note by its path", inputSchema: { path: z .string() .min(1) .describe("Relative path to the note within the vault"), }, }, async ({ path: notePath }) => { try { const content = await readNote(vaultPath, notePath); const { data: frontmatterData, content: bodyContent } = parseFrontmatter(content); const header: string[] = []; if (Object.keys(frontmatterData).length > 0) { header.push("--- Frontmatter ---"); for (const [key, value] of Object.entries(frontmatterData)) { header.push(`${key}: ${JSON.stringify(value)}`); } header.push("--- End Frontmatter ---"); header.push(""); } const tags = extractTags(content); if (tags.length > 0) { header.push(`Tags: ${tags.join(", ")}`); header.push(""); } return { content: [ { type: "text" as const, text: header.length > 0 ? header.join("\n") + bodyContent : content, }, ], }; } catch (err) { console.error("get_note error:", err); return errorResult(`Error reading note: ${err instanceof Error ? err.message : String(err)}`); } }, );