Skip to content

Commit bce5984

Browse files
committed
range hash
1 parent 9a4f317 commit bce5984

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/mcp_text_editor/text_editor.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,9 @@ async def edit_file_contents(
394394
# For non-insertion operations, verify content hash
395395
if not is_insertion:
396396
if actual_range_hash != expected_range_hash:
397-
print(
398-
f"Debug - Hash mismatch:\n"
399-
f"Expected hash: {expected_range_hash}\n"
400-
f"Actual hash: {actual_range_hash}\n"
401-
f"Content being replaced: {target_content!r}\n"
402-
f"Range: {line_start_zero}:{line_end_zero + 1}"
403-
)
404397
return {
405398
"result": "error",
406-
"reason": "Content hash mismatch - file has been modified",
399+
"reason": f"Content hash mismatch - file has been modified since last read. Please use get_text_file_contents tool with lines {line_start}-{line_end} to get current content and hashes, then retry with the updated hashes. Expected: {expected_range_hash}, Actual: {actual_range_hash}. Content: {target_content!r}",
407400
"file_hash": None,
408401
"content": current_content,
409402
}

0 commit comments

Comments
 (0)