edit_note
Modify existing Obsidian notes with overwrite, append, or precise replace modes; replace needs a unique fragment and supports optional etag locking to prevent write conflicts.
Instructions
编辑 Obsidian vault 中已有笔记,三种模式:overwrite 整体覆盖、append 末尾追加、replace 把 old_string 精准替换为 content(字面替换,非正则)。replace 要求片段唯一,多处匹配时报错(可改传 replace_all=true);未找到时报错且文件不变。推荐先 read_note 拿到原文再 replace。
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>",
"mode": "<mode>",
"content": "<content>"
},
"name": "edit_note"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | overwrite=整体覆盖;append=在文末追加;replace=把 old_string 精准替换为 content | |
| path | Yes | 要编辑的笔记路径(vault 内 POSIX 风格相对路径,需以 .md 结尾) | |
| content | Yes | overwrite/append 模式:要写入的新内容;replace 模式:替换后的文本(可为空串实现删除片段) | |
| if_match | No | 乐观锁:传入上次 read_note 返回的 etag,与当前内容不符时拒绝写入(推荐多客户端场景使用) | |
| old_string | No | replace 模式必填:要被替换的原文片段;需在文中唯一,否则须传 replace_all=true | |
| replace_all | No | replace 模式:替换全部匹配;默认 false(片段必须唯一才执行) |