Skip to main content
Glama
Vault Cortex Obsidian MCP Server

Vault Cortex Obsidian MCP Server

Write File

vault_write_file
Destructive

Creates or overwrites non-markdown vault files such as canvases, Bases, JSON, CSV and SVG, so MCP clients without local file tools can build and edit data files directly.

Instructions

Create a non-markdown text file, or with overwrite: true replace one.

Example: vault_write_file({ path: "Boards/Roadmap.canvas", content: "{"nodes":[],"edges":[]}" }) Example: vault_write_file({ path: "Bases/Books.base", content: "views:\n - type: table\n name: All\n", overwrite: true })

When to use: Editing a canvas, a Base or a data file (.json, .csv, .svg, .txt, a script) from a client without local file tools. Read the current source first with vault_read_file (raw: true for a canvas), then write the whole file back with overwrite: true. For .md notes use vault_write_note.

Behavior: content is saved as given, encoded as UTF-8. An overwrite keeps no copy of the replaced file.

Errors:

  • "file already exists" — set overwrite: true to replace it

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

  • "cannot write … as text" — the path names an image or a PDF; save it outside the server

  • "cannot write file …: that path is not a file" — a folder or a broken symlink already has this name; choose another path

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

  • "concurrent write in progress" — a write to this file is in flight; re-read it and retry

  • "content contains a control character" — remove the character the message names

  • "invalid .canvas JSON" / "invalid JSON" / "invalid .base YAML" — .canvas and .json must be valid JSON (a canvas: an object whose nodes and edges, when present, are arrays), .base YAML with a mapping, or nothing, at the top; fix what the message names

  • "cannot overwrite …: it holds binary data" — the file at the path holds a NUL byte near its start; replace or remove it outside the server, or write to another path

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

Obsidian syntax: .canvas is JSON Canvas 1.0: nodes carry id, type (text, file, link or group), x, y, width and height, plus text, file, url or label; edges carry id, fromNode and toNode. .base is Obsidian Bases YAML (filters, formulas, properties, views).

Returns: "Wrote ".

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>",
      "content": "<content>"
    },
    "name": "vault_write_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesVault-relative path including the extension (e.g. "Boards/Roadmap.canvas"). Must NOT end in ".md", ".MD" or another casing of it. Parent folders are created as needed. Use the exact letter case.
contentYesThe file's complete text.
overwriteNoAllow replacing an existing file (default: false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.57.8

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true, but the description adds substantive context: content is written verbatim as UTF-8, overwrite leaves no backup copy, there is no implicit merge, concurrent writes are rejected, and binary/markdown/symlink paths are refused with named errors. This goes well beyond the annotation set without contradicting it.

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?

Front-loaded with purpose, then examples, when-to-use, behavior, errors, and return value in a clear hierarchy. The error catalogue is long (eleven entries), but each maps to a distinct recoverable failure; slightly aggressive length is the only cost.

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?

Covers everything needed for a destructive write with no output schema: return value ('Wrote <path>'), encoding, overwrite semantics, error-to-remedy mapping, and enough JSON Canvas 1.0 / Bases structure to author valid content. Nothing an agent needs to call this correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description adds real meaning: overwrite governs replacement of an existing file, path must be vault-relative with an explicit extension and no dot-prefixed segment, and the examples demonstrate the exact content format for .canvas and .base. It stops short of documenting any nuance the schema lacks for 'content'.

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 ('Create a non-markdown text file ... with overwrite: true replace one') and bounds the scope by excluding markdown, immediately routing .md writes to vault_write_note. An agent can distinguish this from vault_write_note and vault_patch_note without opening any 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' section naming the file types (canvas, Base, .json/.csv/.svg/.txt, scripts) and the selecting condition ('from a client without local file tools'), plus the required read-then-rewrite workflow via vault_read_file with raw: true. It also names the alternative for markdown and gives two concrete call examples.

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