agentleFS
a1ecbr0wna1ecbr0wn/obsidian-mcp-brain/skills/read-file/SKILL.md

read-file

Skill1 starsChanged 17 days agoApache-2.0View on GitHub

Read a PDF, image or other non-note file from an Obsidian vault through the obsidian-mcp-brain server's read-file tool. Use whenever the user asks to read, open, summarise or look at a PDF, image or other non-markdown file that is in the vault. It first checks which Claude surface it is running on, because Claude chat surfaces show only images and silently drop other file types.

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use attach-db and query.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • duckdbSkill

    attach-db

    Attach a DuckDB database file for use with /duckdb-skills:query. Explores the schema (tables, columns, row counts) and writes a SQL state file so subsequent queries can restore this session automatically via duckdb -init.

    Also in 3 projects that use this

  • ArtemXTechSkill

    query

    Query data from this vault. USE WHEN user asks about projects, clients, tasks, daily notes. Use grep to extract frontmatter - do NOT read full files.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Look at where this skill file was loaded from and at the home directory:

    line 27
  2. Distinctive:

    If you cannot tell, go to step 2 and use the check in step 3.

    line 35
  3. Distinctive:

    Only stop for a file that is not an image.

    line 39
  4. Distinctive:

    When you stop, say this to the user, with the file name filled in:

    line 42
  5. Very specific:

    Do not try to work around it by base64-encoding the file into a message, or by calling read-file repeatedly.

    line 49
  6. Very specific:

    If you do not know the path, call list-files (give extension, for example pdf, and, optionally, path to narrow it to a folder).

    line 54
  7. Very specific:

    Call read-file with vault, filename and folder.

    line 56
  8. Distinctive:

    Do not guess a file's contents from its name when the read did not work.

    line 80
  9. Distinctive:

    Do not move or copy the file to another name or location to try again: the failure is about the file's type and the client, not its name or …

    line 82

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Read a non-note file from the vault

read-file returns a file as an MCP embedded resource block (base64 bytes and a MIME type). What happens next depends on the client:

  • Claude Code (including the code mode of the Claude Desktop app) saves the bytes to a file and gives you its path. You then open that path with your file-reading tool, which reads PDFs.
  • Claude Desktop chat passes an embedded resource to the model only if it is an image. A PDF is dropped without any error, and a text file such as a CSV is rejected with The tool returned an image in an unsupported format. (tested). claude.ai chat is reported to behave the same way but has not been tested here. As far as we can tell this is the client's behaviour, so nothing the server does changes it, and retrying does not help.

So check where you are before reading anything that is not an image.

Step 1: work out which surface you are on

Look at where this skill file was loaded from and at the home directory:

This skill is found atSurfaceReading a non-image file
~/.claude/skills/read-file/, or a folder under ~/.claude/plugins/ (an installed plugin), under a home that is not claude (/home/<user>, /Users/<user>)Claude CodeWorks. Go to step 2
/mnt/skills/user/... or /mnt/skills/plugins/..., or the home directory is /home/claudeClaude Desktop chat or claude.ai chatDoes not work (tested in Desktop chat, reported for claude.ai). Stop and tell the user (below)
/root/.claude/skills/synced/<bucket-id>/...CoworkNot tested. Go to step 2 and rely on the check in step 3

If you cannot tell, go to step 2 and use the check in step 3.

An image is expected to be fine on every surface (WebP was tested in Claude Desktop chat; PNG, JPEG and GIF are the other formats reported to be shown). Only stop for a file that is not an image. Treat SVG as a non-image: it is not one of those formats.

When you stop, say this to the user, with the file name filled in:

<file> is a PDF (or other non-image file), and this chat can't show non-image files from the vault: it drops them without an error. Open the vault in a Claude Code chat (in the Claude Desktop app, the code mode) and ask there; the same MCP server works in it.

Do not try to work around it by base64-encoding the file into a message, or by calling read-file repeatedly.

Step 2: find and read the file

  1. If you do not know the path, call list-files (give extension, for example pdf, and, optionally, path to narrow it to a folder).
  2. Call read-file with vault, filename and folder. A .md note can be read too, but read-note is better for a note.
  3. In Claude Code, the result gives a saved path. Open it with your file-reading tool. A PDF with a text layer is read as text, and a scanned PDF is read from rendered page images.

Step 3: check the result

  • A text line and a file you can open: you are done. The sha256: and Last-Modified: lines name the version you read; the replace-file skill needs them to replace the file.
  • Only the text lines (<path> (<n> bytes, <mime type>), then sha256: and Last-Modified:) and no file or content, for a file that is not an image: this surface drops non-image files. Stop and tell the user as in step 1. Do not call the tool again.
  • The operation timed out on a large file that has not been read recently: the server is still working and a second call is fast. Call it again, up to twice, then tell the user.
  • Reading is restricted for '<path>': the owner has protected the file. Tell the user; do not look for another way to read it.
  • The file is larger than the limit: the message says so. Tell the user.

Rules

  • Do not guess a file's contents from its name when the read did not work. Say that you could not read it.
  • Do not move or copy the file to another name or location to try again: the failure is about the file's type and the client, not its name or size.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.