Skip to main content
Glama

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
NameRequiredDescriptionDefault
pathYesRelative path to the note within the vault

Implementation Reference

  • 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)}`);
        }
      },
    );
  • 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"),
        },
      },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rps321321/obsidian-mcp-pro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server