patch_note
Find and replace specific text in a Trilium note without rewriting the entire content. Specify occurrence to disambiguate multiple matches, ensuring precise edits.
Instructions
Find-and-replace a piece of a note's content without resending the whole note. Rejects the call if "search" matches zero or more than one location, unless "occurrence" is given to disambiguate.
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": {
"noteId": "<noteId>",
"search": "<search>",
"replace": "<replace>"
},
"name": "patch_note"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | ID of the note to patch | |
| search | Yes | Literal text (or regex pattern, if isRegex is true) to find in the note content | |
| isRegex | No | Treat "search" as a regular expression instead of literal text (default: false) | |
| replace | Yes | Text to replace the match with | |
| occurrence | No | 1-based index of the match to replace. Required when "search" matches more than one location. | |
| contentFormat | No | Format "search" and "replace" are expressed in: "markdown" (default, matches what get_note returns) or "html" (the raw stored format) | markdown |