@@ -180,7 +180,7 @@ async def read_file_contents(
180
180
async def edit_file_contents (
181
181
self ,
182
182
file_path : str ,
183
- expected_file_hash : str ,
183
+ expected_hash : str ,
184
184
patches : List [Dict [str , Any ]],
185
185
encoding : str = "utf-8" ,
186
186
) -> Dict [str , Any ]:
@@ -189,7 +189,7 @@ async def edit_file_contents(
189
189
190
190
Args:
191
191
file_path (str): Path to the file to edit
192
- expected_file_hash (str): Expected hash of the file before editing
192
+ expected_hash (str): Expected hash of the file before editing
193
193
patches (List[EditPatch]): List of patches to apply
194
194
- line_start (int): Starting line number (1-based, optional, default: 1)
195
195
- line_end (Optional[int]): Ending line number (inclusive)
@@ -198,7 +198,7 @@ async def edit_file_contents(
198
198
199
199
Args:
200
200
file_path (str): Path to the file to edit (parent directories are created automatically)
201
- expected_file_hash (str): Expected hash of the file before editing (empty string for new files)
201
+ expected_hash (str): Expected hash of the file before editing (empty string for new files)
202
202
patches (List[Dict[str, Any]]): List of patches to apply, each containing:
203
203
- line_start (int): Starting line number (1-based)
204
204
- line_end (Optional[int]): Ending line number (inclusive)
@@ -208,7 +208,7 @@ async def edit_file_contents(
208
208
Returns:
209
209
Dict[str, Any]: Results of the operation containing:
210
210
- result: "ok" or "error"
211
- - file_hash : New file hash if successful, None if error
211
+ - hash : New file hash if successful, None if error
212
212
- reason: Error message if result is "error"
213
213
"content": None,
214
214
}
@@ -218,7 +218,7 @@ async def edit_file_contents(
218
218
self ._validate_file_path (file_path )
219
219
try :
220
220
if not os .path .exists (file_path ):
221
- if expected_file_hash not in ["" , None ]: # Allow null hash
221
+ if expected_hash not in ["" , None ]: # Allow null hash
222
222
return {
223
223
"result" : "error" ,
224
224
"reason" : "File not found and non-empty hash provided" ,
@@ -253,14 +253,14 @@ async def edit_file_contents(
253
253
current_content = ""
254
254
current_hash = ""
255
255
lines = []
256
- elif current_content and expected_file_hash == "" :
256
+ elif current_content and expected_hash == "" :
257
257
return {
258
258
"result" : "error" ,
259
259
"reason" : "Unexpected error - Cannot treat existing file as new" ,
260
260
"file_hash" : None ,
261
261
"content" : None ,
262
262
}
263
- elif current_hash != expected_file_hash :
263
+ elif current_hash != expected_hash :
264
264
return {
265
265
"result" : "error" ,
266
266
"reason" : "FileHash mismatch - Please use get_text_file_contents tool to get current content and hashes, then retry with the updated hashes." ,
@@ -298,7 +298,7 @@ async def edit_file_contents(
298
298
return {
299
299
"result" : "error" ,
300
300
"reason" : "Overlapping patches detected" ,
301
- "file_hash " : None ,
301
+ "hash " : None ,
302
302
"content" : None ,
303
303
}
304
304
@@ -327,7 +327,7 @@ async def edit_file_contents(
327
327
if (
328
328
os .path .exists (file_path )
329
329
and current_content
330
- and expected_file_hash == ""
330
+ and expected_hash == ""
331
331
):
332
332
return {
333
333
"result" : "error" ,
0 commit comments