Write File
vault_write_fileCreates 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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Vault-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. | |
| content | Yes | The file's complete text. | |
| overwrite | No | Allow replacing an existing file (default: false). |