summaryrefslogtreecommitdiffhomepage
path: root/src/tools.ts
diff options
context:
space:
mode:
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}".`;