Edit note
edit_noteModify an existing Obsidian note: replace the whole body, append, find-and-replace text, or rewrite one section, with optional dry-run diff and hash precondition to block stale overwrites.
Instructions
Edit an existing note in the Obsidian vault. Requires write permission (a readwrite API key or OAuth scope).
Arguments: path, content, at most one mode flag — append, find or section (operation is a
legacy alias) — plus replace_all, dry_run, replace_frontmatter, and the expected_hash
precondition. Every refusal the server raises ends with one machine-readable MCP-REFUSAL {"code":…}
line; an undeclared or mistyped argument is rejected by protocol validation before the tool runs and
carries no such line. See get_vault_guide for vault conventions.
Modes (mutually exclusive):
Full replace (default):
contentbecomes the note's body; an existing valid line-1 YAML frontmatter block is preserved byte-identically ahead of it.replace_frontmatter=Trueoverwrites the entire file, frontmatter included. A note with no valid block is replaced wholesale. Change frontmatter withset_frontmatterorfind=; never write backread_note'sfrontmatterJSON view. The round-trip guarantee covers a complete, unwindowed whole-note read only — nosection,offset=0,truncatedfalse; page a truncated read to the end first, or full replacement replaces the whole body with the fragment. A section response belongs to section mode.Append:
append=True;contentis added at the end, after one newline.Find & replace:
find=<exact text>is replaced withcontent; it must match exactly once unlessreplace_all=True.Section:
section=<heading>replaces the whole body under the named ATX heading.Parent/Childdisambiguates repeated headings; a#Nordinal ("#7", 1-based document order) is the only form that addresses duplicate siblings. A selector resolves to the same section here as inread_noteon any write this tool admits — parity is about resolution, not admission.
dry_run=True returns a unified diff and writes nothing.
expected_hash: pass the content_hash a read returned, verbatim, and the call is refused with
nothing written if the file changed since — in every mode, dry_run included. It is the whole file's
hash, never a hash of the text you received. Optional by default — omitted, a stale edit overwrites —
unless the deployment requires it, when an omitted hash is refused precondition_required. Codes:
stale_precondition, concurrent_write, no_incumbent, malformed_precondition,
precondition_unavailable, precondition_required. Success reports the content_hash of the bytes
this call wrote, not what is on disk when you read it; dry_run reports none.
Section mode. content is the section's body: the text beginning on the line immediately after the
matched heading line; the heading line is never rewritten. The body is replaced whole — anything
content does not resend, a fenced code block under the heading included, is deleted — so a blank
line you want after the heading belongs in content. read_note(path, section=...) is the matching read:
its heading field carries the heading line and its content field the body, and this tool takes exactly
that content. Byte-identity holds for notes whose body newlines are LF: non-LF terminators inside the
selected body come back as LF. #N ordinals agree with read_note; a heading inside a fenced code block is
not a heading.
Two shapes refuse a section write outright, naming the problem and writing nothing: a malformed
frontmatter block, whose refusal names the replace_frontmatter=True repair; and a fence opener indented by
one to three spaces that nothing below it closes — close the fence or unindent it to column zero, then
reissue. Both are asymmetric with reads: read_note keeps working on such notes. A symlinked
final component is refused.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | No | ||
| path | Yes | ||
| append | No | ||
| content | Yes | ||
| dry_run | No | ||
| section | No | ||
| operation | No | ||
| replace_all | No | ||
| expected_hash | No | ||
| replace_frontmatter | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |