get_note
Read the full content of an Obsidian note by specifying its relative path within the vault to access and retrieve note information.
Instructions
Read the full content of a note by its path
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Relative path to the note within the vault |
Implementation Reference
- src/tools/read.ts:87-123 (handler)The handler function for the 'get_note' tool, which reads the file content, extracts frontmatter/tags, and formats the output.
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)}`); } }, ); - src/tools/read.ts:76-86 (registration)Registration of the 'get_note' tool with its schema definition.
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"), }, },