The vault. Must allow writes (for non-dry-run apply).
ReplaceInNotesArgs. search must be non-empty
and not equal to replace.
A ReplaceInNotesResult with per-file counts, totals, and partial-write observability.
On invalid args (empty search, search === replace),
privacy-excluded folder, or a systemic write failure (read-only vault).
// Preview a typo fix
const preview = await replaceInNotes(vault, {
search: "embedings",
replace: "embeddings",
dry_run: true,
case_sensitive: false
});
console.log(`Would update ${preview.files_updated.length} files`);
// Apply
await replaceInNotes(vault, {
search: "embedings",
replace: "embeddings",
case_sensitive: false
});
Bulk literal-substring find/replace across the vault, code-fence aware.
Walks every note (optionally scoped to
folder), replaces every occurrence ofsearchwithreplaceoutside fenced code blocks (```and~~~), and writes results. The fence-awareness is critical — bulk find/replace that touches example snippets in documentation has been a historical foot-gun. Per-file write errors are collected (not thrown) so a single bad write doesn't lose the rest of the apply; checkpartialanderrorsin the response. WRITE TOOL — only registered with--enable-write.