Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_read_note

Read-only

Read a note from your Obsidian vault in multiple formats: raw content, full structure, document map, or a specific section.

Instructions

Read a note as raw content, full structured content, a document map, or one section.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vaultNoOptional configured vault name. Defaults to the server default vault.
pathYesVault-relative path. Absolute paths and traversal are rejected.
formatNofull
sectionTypeNo
sectionNo
includeLinksNo

Implementation Reference

  • src/tools.ts:120-153 (registration)
    Registration of the obsidian_read_note tool with its schema and handler in the registerObsidianTools function.
    tool(
      "obsidian_read_note",
      "Read a note as raw content, full structured content, a document map, or one section.",
      {
        vault: vaultArg,
        path: pathArg,
        format: z.enum(["content", "full", "document-map", "section"]).optional().default("full"),
        sectionType: z.enum(["heading", "block", "frontmatter"]).optional(),
        section: z.string().optional(),
        includeLinks: z.boolean().optional().default(true),
      },
      async (args) => {
        const read = await vaults.readText(args.path, args.vault);
        if (args.format === "content") return { path: read.path, content: read.text };
        if (args.format === "document-map") return documentMap(read.path, read.text);
        if (args.format === "section") {
          if (!args.sectionType || !args.section) throw new Error("sectionType and section are required for format=section");
          const selector = selectorFrom(args.sectionType, args.section);
          const range = findSectionRange(read.text, selector);
          if (!range) return { path: read.path, found: false };
          return { path: read.path, found: true, content: read.text.slice(range.start, range.end) };
        }
        const parsed = parseFrontmatter(read.text);
        return {
          path: read.path,
          content: read.text,
          frontmatter: parsed.data,
          tags: extractAllTags(read.text),
          stat: { size: read.stat.size, mtime: read.stat.mtime.toISOString(), ctime: read.stat.ctime.toISOString() },
          links: args.includeLinks ? { wiki: extractWikiLinks(read.text), markdown: extractMarkdownLinks(read.text) } : undefined,
        };
      },
      { readOnlyHint: true },
    );
  • Handler function for the obsidian_read_note tool. Reads a note from the vault and returns content, full structured data, a document map, or a section based on the format parameter. Uses vaults.readText (from src/vault.ts line 89) to read the file, parseFrontmatter (from src/frontmatter.ts line 12) to parse YAML frontmatter, and helper functions like documentMap and selectorFrom for formatting.
    async (args) => {
      const read = await vaults.readText(args.path, args.vault);
      if (args.format === "content") return { path: read.path, content: read.text };
      if (args.format === "document-map") return documentMap(read.path, read.text);
      if (args.format === "section") {
        if (!args.sectionType || !args.section) throw new Error("sectionType and section are required for format=section");
        const selector = selectorFrom(args.sectionType, args.section);
        const range = findSectionRange(read.text, selector);
        if (!range) return { path: read.path, found: false };
        return { path: read.path, found: true, content: read.text.slice(range.start, range.end) };
      }
      const parsed = parseFrontmatter(read.text);
      return {
        path: read.path,
        content: read.text,
        frontmatter: parsed.data,
        tags: extractAllTags(read.text),
        stat: { size: read.stat.size, mtime: read.stat.mtime.toISOString(), ctime: read.stat.ctime.toISOString() },
        links: args.includeLinks ? { wiki: extractWikiLinks(read.text), markdown: extractMarkdownLinks(read.text) } : undefined,
      };
    },
  • Zod schema for the obsidian_read_note tool defining input parameters: vault (optional), path (required), format (optional enum with default 'full'), sectionType (optional enum), section (optional string), includeLinks (optional boolean default true).
    {
      vault: vaultArg,
      path: pathArg,
      format: z.enum(["content", "full", "document-map", "section"]).optional().default("full"),
      sectionType: z.enum(["heading", "block", "frontmatter"]).optional(),
      section: z.string().optional(),
      includeLinks: z.boolean().optional().default(true),
    },
  • Helper function used by obsidian_read_note when format='document-map'. Returns a structural map of the note including frontmatter keys, tags, headings, block references, and links.
    function documentMap(notePath: string, markdown: string): unknown {
      const parsed = parseFrontmatter(markdown);
      return {
        path: notePath,
        frontmatterKeys: Object.keys(parsed.data),
        tags: extractAllTags(markdown),
        headings: extractHeadings(markdown),
        blocks: extractBlockRefs(markdown),
        links: { wiki: extractWikiLinks(markdown), markdown: extractMarkdownLinks(markdown) },
      };
    }
  • Helper function used by obsidian_read_note when format='section'. Converts section type and value into a SectionSelector object for findSectionRange.
    function selectorFrom(type: "heading" | "block" | "frontmatter", value: string): SectionSelector {
      if (type === "heading") return { type, heading: value };
      if (type === "block") return { type, block: value.replace(/^\^/, "") };
      return { type, key: value };
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnlyHint=true (safe read). The description adds value by specifying the four possible return types (content, full, document-map, section), which is not in the annotations. It does not contradict annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence efficiently conveys the tool's capability. No unnecessary words or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read tool with 6 parameters and no output schema, the description is minimal. It does not explain that the 'section' format requires the sectionType and section parameters, or that includeLinks applies only to certain formats. More detail would help the agent use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 33% (most parameter descriptions come from schema fields). The description does not elaborate on how to use parameters like sectionType, section, or includeLinks. However, the mention of 'one section' hints at the section format, providing some context beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb 'Read' and resource 'a note', and lists the four possible output formats: raw content, full structured content, document map, or section. This distinguishes it from write or modification siblings like obsidian_patch_note or obsidian_delete_note.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like obsidian_read_many or obsidian_search. The purpose is implied by the name and description, but no exclusions or alternative suggestions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/jagoff/obsidian-mcp'

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