summaryrefslogtreecommitdiffhomepage
path: root/src/tools.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-03-28 05:15:49 +0900
committerAdam Malczewski <[email protected]>2026-03-28 05:15:49 +0900
commitff4fd494811d326986cfe0305f35b89e37dd493c (patch)
tree947209f20098279b1b334db653300f1e3bb43aa6 /src/tools.ts
parentbe2dee39e5bf907dfdd3462817203a08cf3c345f (diff)
downloadai-pulse-obsidian-plugin-ff4fd494811d326986cfe0305f35b89e37dd493c.tar.gz
ai-pulse-obsidian-plugin-ff4fd494811d326986cfe0305f35b89e37dd493c.zip
no=op validation, and red tool error messages
Diffstat (limited to 'src/tools.ts')
-rw-r--r--src/tools.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools.ts b/src/tools.ts
index a4eb16e..57e21c1 100644
--- a/src/tools.ts
+++ b/src/tools.ts
@@ -338,6 +338,11 @@ async function executeEditFile(app: App, args: Record<string, unknown>): Promise
const oldText = typeof args.old_text === "string" ? args.old_text : "";
const newText = typeof args.new_text === "string" ? args.new_text : "";
+ // Reject no-op edits where old_text and new_text are identical
+ if (oldText === newText) {
+ return `Error: old_text and new_text are identical — no change would occur. Provide different text for new_text, or skip this edit.`;
+ }
+
const file = app.vault.getAbstractFileByPath(filePath);
if (file === null || !(file instanceof TFile)) {
return `Error: File not found at path "${filePath}".`;