@@ -239,7 +239,7 @@ async def edit_file_contents(
239
239
- result: "ok" or "error"
240
240
- hash: New file hash if successful, None if error
241
241
- reason: Error message if result is "error"
242
- "content ": None,
242
+ "file_hash ": None,
243
243
}
244
244
245
245
# Read current file content and verify hash
@@ -251,7 +251,6 @@ async def edit_file_contents(
251
251
return {
252
252
"result" : "error" ,
253
253
"reason" : "File not found and non-empty hash provided" ,
254
- "content" : None ,
255
254
}
256
255
# Create parent directories if they don't exist
257
256
parent_dir = os .path .dirname (file_path )
@@ -262,7 +261,6 @@ async def edit_file_contents(
262
261
return {
263
262
"result" : "error" ,
264
263
"reason" : f"Failed to create directory: { str (e )} " ,
265
- "content" : None ,
266
264
}
267
265
# Initialize empty state for new file
268
266
current_content = ""
@@ -284,14 +282,11 @@ async def edit_file_contents(
284
282
return {
285
283
"result" : "error" ,
286
284
"reason" : "Unexpected error - Cannot treat existing file as new" ,
287
- "file_hash" : None ,
288
- "content" : None ,
289
285
}
290
286
elif current_hash != expected_hash :
291
287
return {
292
288
"result" : "error" ,
293
289
"reason" : "FileHash mismatch - Please use get_text_file_contents tool to get current content and hashes, then retry with the updated hashes." ,
294
- "content" : None ,
295
290
}
296
291
else :
297
292
lines = current_content .splitlines (keepends = True )
@@ -324,8 +319,6 @@ async def edit_file_contents(
324
319
return {
325
320
"result" : "error" ,
326
321
"reason" : "Overlapping patches detected" ,
327
- "hash" : None ,
328
- "content" : None ,
329
322
}
330
323
331
324
# Apply patches
@@ -355,12 +348,7 @@ async def edit_file_contents(
355
348
and current_content
356
349
and expected_hash == ""
357
350
):
358
- return {
359
- "result" : "error" ,
360
- "reason" : "Unexpected error" ,
361
- "file_hash" : None ,
362
- "content" : None ,
363
- }
351
+ return {"result" : "error" , "reason" : "Unexpected error" }
364
352
365
353
# Calculate line ranges for zero-based indexing
366
354
start_zero = start - 1
@@ -400,7 +388,6 @@ async def edit_file_contents(
400
388
return {
401
389
"result" : "error" ,
402
390
"reason" : "Content range hash mismatch - Please use get_text_file_contents tool with the same start and end to get current content and hashes, then retry with the updated hashes." ,
403
- "content" : current_content ,
404
391
}
405
392
406
393
# Prepare new content
@@ -435,18 +422,9 @@ async def edit_file_contents(
435
422
}
436
423
437
424
except FileNotFoundError :
438
- return {
439
- "result" : "error" ,
440
- "reason" : f"File not found: { file_path } " ,
441
- "file_hash" : None ,
442
- "content" : None ,
443
- }
425
+ return {"result" : "error" , "reason" : f"File not found: { file_path } " }
444
426
except (IOError , UnicodeError , PermissionError ) as e :
445
- return {
446
- "result" : "error" ,
447
- "reason" : f"Error editing file: { str (e )} " ,
448
- "content" : None ,
449
- }
427
+ return {"result" : "error" , "reason" : f"Error editing file: { str (e )} " }
450
428
except Exception as e :
451
429
import traceback
452
430
@@ -455,7 +433,7 @@ async def edit_file_contents(
455
433
return {
456
434
"result" : "error" ,
457
435
"reason" : "Unexpected error occurred" ,
458
- "content " : None ,
436
+ "file_hash " : None ,
459
437
}
460
438
461
439
async def insert_text_file_contents (
0 commit comments