Skip to main content
Glama
Vault Cortex Obsidian MCP Server

Vault Cortex Obsidian MCP Server

Read File

vault_read_file
Read-onlyIdempotent

Read non-markdown vault files and return images, canvas outlines, PDF text, or text/data content, with optional line ranges for large files.

Instructions

Read a non-markdown vault file in its most useful form per type — the read-side companion to vault_read_note for everything that isn't a note.

Example: vault_read_file({ path: "attachments/diagram.png" }) — the image itself, shrunk when too large Example: vault_read_file({ path: "Boards/Roadmap.canvas" }) — a readable outline of the canvas Example: vault_read_file({ path: "exports/data.json" }) — the file content as text Example: vault_read_file({ path: "exports/big.csv", limit: 500 }) — the first 500 lines Example: vault_read_file({ path: "papers/research.pdf" }) — structured text with title, headings, and links

When to use: whenever a note references a file you need to actually see or read — an embedded diagram, a linked canvas, data file, or PDF. Find the files a note links to (with byte sizes) via vault_get_outgoing_links. Browse a folder's files via vault_list_files. vault_search also indexes the content of canvases and PDFs, the visible text of HTML pages (.html/.htm), scripts (.py/.sh/.ps1), and the text formats .txt/.csv/.json/.xml/.svg/.log/.yaml/.yml/.base, but not images or other files. For .md notes use vault_read_note. To check a large file's line count before reading it whole, request start_line: 1 with limit: 1 — one line plus the total.

Parameters:

  • raw: true switches a canvas or PDF to its other form. A canvas returns its exact JSON source (geometry, ids, colors) instead of the outline. A PDF returns each page rendered as an image instead of extracted text, showing layout, diagrams, tables, and formatting; only the first 5 pages are rendered, and later pages are readable only as text, without raw.

  • start_line and limit page any text result as a line window. The text output cap (a fixed 100 KiB) applies to each window, so one very long line can still overflow it; paging never gets around the file-size cap.

Behavior: A paged window comes back with \n line endings and no trailing newline, preceded by a metadata line stating the window, the total line count, and where to continue ("data.csv — lines 51–100 of 400 (continue with start_line: 101)"); an unpaged read of a text file returns the file byte-exact.

Errors:

  • "not a file: … is a markdown note" — the path ends in .md; read notes with vault_read_note

  • "file not found" — no file exists at that path (a folder is not a file); discover valid paths via vault_list_files

  • "absolute path blocked" / "path traversal blocked" / "hidden path blocked" — pass a vault-relative path with no dot-prefixed part

  • "file too large" — the file exceeds the file-size cap (MAX_FILE_BYTES, default 50 MiB), which the server's operator can raise

  • "text output too large" — a text file, canvas, or PDF renders past the text output cap; page it with start_line and limit, or reduce limit when a single window overflows

  • "start line past the end" — start_line exceeds the file's line count; the error states the total, so retry with a smaller start_line

  • "line range is not available" (start_line or limit on an image, or on a PDF read with raw: true) / "raw source is not available for images" (raw on an image) — drop that input

  • "not valid UTF-8" — the file's bytes aren't UTF-8 text; ask for a UTF-8 copy

  • "invalid .canvas JSON" — the canvas file is empty or not valid JSON; set raw: true to read its source as text

  • "PDF has no extractable text" — the PDF contains no text (scanned or image-only); the error states the page count. Set raw: true to render pages as images instead

  • "PDF is password-protected" — read an unprotected copy instead

  • "PDF is damaged or not a PDF" / "could not decode image" — the PDF does not parse, or the image is empty, damaged, not an image despite its extension, or over about 268 million pixels; any other PDF or image error comes back in the reading library's own words. Replace or re-export the file

  • "PDF page rendering failed" — read it without raw: true to get its text instead; if that read also finds no text, this tool can't read the PDF

  • "image cannot be fitted into …" — the image is over the image output budget even after shrinking; ask the server's operator to raise MAX_IMAGE_OUTPUT_BYTES

  • "ENAMETOOLONG: …" or another filesystem error — the message says what to do

  • "file changed while reading" — retry the read

  • "PDF reader could not start" / "PDF text extraction stopped" — split or re-export the PDF, or provide a text copy, when the message says to; otherwise retry later, and when "could not start" repeats, ask the server's operator to check the server log

  • "unsupported file type …" — the file holds binary data (audio, archives, UTF-16 text, …); the error names the readable types plus the file's existence and size. Ask for a UTF-8 copy of UTF-16 text

Returns: by file type:

  • Images (.png/.jpg/.jpeg/.gif/.webp): an image content block plus a one-line metadata text block. The image is downscaled and recompressed when it exceeds the image output budget (49152 bytes) or has a longer side over 1568 pixels; an animated GIF is reduced to its first frame when recompressed.

  • Canvas (.canvas): one text block holding a readable markdown outline — groups, node content in reading order, and a connections list with edge labels.

  • PDFs (.pdf): one text block of structured text with document metadata — title, page count, heading hierarchy, code blocks and inline code, page separators, and a links footer; with raw: true, a metadata text block followed by alternating image and text blocks (one pair per page).

  • Any other UTF-8 text file (.svg, .json, .csv, .html, .py, no extension, …): one text block holding the file content.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "vault_read_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
rawNoReturn a canvas's or PDF's alternative form. Changes nothing for text formats.
pathYesVault-relative path to the file, including any extension (e.g. "attachments/photo.png", "Boards/Roadmap.canvas"). Must NOT end in ".md". Use the exact letter case.
limitNoMaximum lines returned (default: all remaining).
start_lineNoFirst line to return, 1-based (default 1).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.57.1
    • changedInput schema / properties / path / description
      Previous value: -"Vault-relative path to the file, including its extension (e.g. \"attachments/photo.png\", \"Boards/Roadmap.canvas\"). Must NOT end in \".md\". Use the exact letter case."New value: +"Vault-relative path to the file, including any extension (e.g. \"attachments/photo.png\", \"Boards/Roadmap.canvas\"). Must NOT end in \".md\". Use the exact letter case."
  2. Changed1 schema field changedv0.56.3
    • changedInput schema / properties / raw / description
      Previous value: -"Return a canvas's or PDF's alternative form. Changes nothing for text formats, which already return their source."New value: +"Return a canvas's or PDF's alternative form. Changes nothing for text formats."
  3. Changed3 schema fields changedv0.54.16
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / path / description
      Previous value: -"Vault-relative path to the file, including its extension (e.g. \"attachments/photo.png\", \"Boards/Roadmap.canvas\"). Must NOT end in \".md\" — notes are read with vault_read_note. Use the exact letter case."New value: +"Vault-relative path to the file, including its extension (e.g. \"attachments/photo.png\", \"Boards/Roadmap.canvas\"). Must NOT end in \".md\". Use the exact letter case."
    • changedInput schema / properties / raw / description
      Previous value: -"Return the file's alternative form: JSON source for .canvas, page images for .pdf. Changes nothing for text formats, which already return their source. Rejected for images."New value: +"Return a canvas's or PDF's alternative form. Changes nothing for text formats, which already return their source."
  4. Changed4 schema fields changedv0.54.7
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum lines returned (default: all remaining). A paged read's metadata line states the window, the total line count, and the next start_line. The output byte cap still applies to the window — reduce limit if it overflows."New value: +"Maximum lines returned (default: all remaining)."
    • changedInput schema / properties / path / description
      Previous value: -"Vault-relative path to the file, including its extension (e.g. \"attachments/photo.png\", \"Boards/Roadmap.canvas\"). Must NOT end in \".md\" — notes are read with vault_read_note."New value: +"Vault-relative path to the file, including its extension (e.g. \"attachments/photo.png\", \"Boards/Roadmap.canvas\"). Must NOT end in \".md\" — notes are read with vault_read_note. Use the exact letter case."
    • changedInput schema / properties / raw / description
      Previous value: -"Return an alternative representation of the file. For .canvas this is the JSON Canvas source (geometry, ids, colors); for .pdf this renders pages as images instead of extracting text — useful for scanned documents, diagrams, and layout-sensitive content. Text formats already return their source, so raw changes nothing there. Images have no text source — raw returns an error."New value: +"Return the file's alternative form: JSON source for .canvas, page images for .pdf. Changes nothing for text formats, which already return their source. Rejected for images."
    • changedInput schema / properties / start_line / description
      Previous value: -"First line to return, 1-based (default 1). Pages any text result — text formats, canvas outlines and raw JSON, PDF-extracted text. Not valid for images or for PDFs with raw: true."New value: +"First line to return, 1-based (default 1)."
  5. Changed2 schema fields changedv0.34.0
    • addedInput schema / properties / limit
      Added value: +{
      +  "description": "Maximum lines returned (default: all remaining). A paged read's metadata line states the window, the total line count, and the next start_line. The output byte cap still applies to the window — reduce limit if it overflows.",
      +  "maximum": 9007199254740991,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / start_line
      Added value: +{
      +  "description": "First line to return, 1-based (default 1). Pages any text result — text formats, canvas outlines and raw JSON, PDF-extracted text. Not valid for images or for PDFs with raw: true.",
      +  "maximum": 9007199254740991,
      +  "minimum": 1,
      +  "type": "integer"
      +}
  6. Addedv0.32.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive), yet the description still adds substantial behavior: per-type return shapes, image downscaling thresholds, the 5-page cap on raw PDF rendering, the fixed 100 KiB text output cap per window, and the byte-exact vs paged output distinction. The exhaustive error catalogue tells the agent exactly how each failure should change its next call.

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

Conciseness4/5

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

Well front-loaded: examples, then when-to-use, then parameters, behavior, errors, returns — an agent can stop reading at any point. The error catalogue is very long for a read tool, and a few entries ("ENAMETOOLONG", "file changed while reading") could be compressed without losing guidance, but nearly every line is actionable rather than filler.

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

Completeness5/5

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

There is no output schema, and the description fully compensates with a per-file-type Returns section covering images, canvas, PDF, and generic text. Combined with paging rules, caps, and the error taxonomy, nothing an agent needs to call this correctly or recover from failure is missing.

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

Parameters5/5

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

Schema coverage is 100%, so the baseline is 3, but the description earns more: it explains that raw means different things per type (canvas JSON source vs outline; PDF page images vs extracted text) and that rendering stops after 5 pages. It also explains the interaction between start_line/limit and the fixed text cap, plus the non-obvious trick of requesting start_line: 1 with limit: 1 to learn the total line count.

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?

States a specific verb and resource ("Read a non-markdown vault file in its most useful form per type") and explicitly positions itself as "the read-side companion to vault_read_note for everything that isn't a note." The five path examples make the scope immediately concrete, so an agent can distinguish it from vault_read_note without opening either schema.

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

Usage Guidelines5/5

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

Has an explicit "When to use" clause ("whenever a note references a file you need to actually see or read") and routes to alternatives by name: vault_get_outgoing_links to discover links, vault_list_files to browse, vault_search for indexed content types, vault_read_note for .md. It even states the exclusion boundary in both directions (images are not indexed by search; .md is not handled here).

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