Skip to main content
Glama

edit_note

Edit Obsidian notes with six modes: append, prepend, replace window, patch heading, patch frontmatter, or at-line. Apply multiple edits atomically in one call.

Instructions

Modify an existing note. Supports six edit modes: append (add to end; defensively inserts a leading newline if the source didn't end with one), prepend (insert after frontmatter if present, otherwise at file start), replace_window (find a block of text and replace it — optionally fuzzy; fuzzy extends match to consume trailing .?! so the replacement has no doubled punctuation), patch_heading (insert or replace content under a specific heading; headingOp: 'before' | 'after' inserts immediately before/after the heading line — use before on the NEXT heading to append to a section's end; headingOp: 'replace' with scope: 'section' (default) replaces to the next same-or-higher heading or EOF — CAREFUL on the LAST heading, this consumes everything below including content separated by blank lines — pass scope: 'body' to stop at the first blank line after the body; if the target heading text appears MORE THAN ONCE the call throws MultipleMatches listing each occurrence with its line number — pass headingIndex: 0 | 1 | ... (0-indexed, top-to-bottom) to pick one), patch_frontmatter (set a single YAML key; pass value: null to clear — or from XML-stringifying clients use valueJson: 'null' for true null, valueJson: 'true' for a real boolean, valueJson: '42' for a number, valueJson: '["a"]' for an array; valueJson wins over value when both are set), at_line (insert or replace at a 1-indexed line number that counts from file start including frontmatter lines). Pass edits (array) to apply multiple edits atomically — all succeed or none are written.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesPath or fuzzy match of the note to edit.
modeNoEdit mode. Required unless `edits` array is provided.
contentNoNew content to insert or replace (meaning is mode-dependent).
searchNoFor `replace_window`: the block of text to locate and replace.
fuzzyNoFor `replace_window`: tolerate whitespace and trailing-punctuation drift.
fuzzyThresholdNoSimilarity threshold for fuzzy replace_window matches (0-1, default 0.7). Higher = stricter. 0.9 is recommended for typo-tolerant matching of known-good text.
headingNoTarget heading text for `patch_heading` mode.
headingOpNoFor `patch_heading`. `replace` (default) replaces section; `before`/`after` inserts adjacent to the heading line.
scopeNoFor `patch_heading replace`: `section` (default) consumes to next same-or-higher heading; `body` stops at first blank line.
headingIndexNoFor `patch_heading` when the heading appears more than once — 0-indexed top-to-bottom picker.
keyNoFor `patch_frontmatter`: the YAML key to set.
valueNoFor `patch_frontmatter`: value to set. Use `null` to clear a key. Prefer `valueJson` from clients that stringify params.
valueJsonNoFor `patch_frontmatter`: JSON-encoded value (wins over `value`). Use `"null"` to clear, `"true"` for boolean, `"42"` for number.
lineNoFor `at_line`: 1-indexed line number (counts from file start including frontmatter).
lineOpNoFor `at_line`: insert before/after the target line, or replace it. Default `replace`.
dryRunNoIf true, return a unified-diff preview without writing. Pass the returned previewId to apply_edit_preview to commit.
from_bufferNoIf true, retry a previously failed replace_window edit using the cached content + search with fuzzy: true, fuzzyThreshold: 0.5. Use when the prior edit failed with NoMatch. Cleared on success.
editsNoArray of edits to apply atomically to a single file. If any edit fails, no edit is written. Applied in order against the accumulated state (each edit sees the result of previous edits in the batch). Use replace_window / patch_heading for content-anchored edits; at_line references the accumulated state, not the original file.
Behavior5/5

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

With no annotations, the description fully discloses behaviors: defensive newline in append, fuzzy trailing punctuation handling, heading duplication throwing MultipleMatches, atomic edits via 'edits' array, dry-run preview, and detailed patch_heading scope behavior. No contradictions with annotations.

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?

The description is detailed and front-loaded with a summary of modes, but it is verbose. Every sentence adds necessary detail given the tool's complexity, though a more structured format (e.g., bullet points) could improve readability.

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?

Given 18 parameters, no output schema, and complex behavior, the description covers all modes, error handling, edge cases, and best practices. It is sufficiently complete for an AI agent to use the tool effectively.

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?

While schema coverage is 100%, the description adds significant meaning beyond schema labels, such as explaining fuzzy threshold recommendation, scope='body' behavior, and valueJson nuances. This adds value for correct parameter usage.

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?

The description clearly states 'Modify an existing note' and details six distinct edit modes (append, prepend, replace_window, etc.), making the tool's purpose specific and distinct from sibling tools like create_note, delete_note, and move_note.

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

Usage Guidelines4/5

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

The description explains when to use each edit mode and provides contextual guidance (e.g., fuzzy trailing punctuation handling, scope for section replacement). However, it does not explicitly compare with alternative tools or state when not to use this tool.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sweir1/obsidian-brain'

If you have feedback or need assistance with the MCP directory API, please join our Discord server