akiko19191 commited on
Commit
c6d59d5
·
verified ·
1 Parent(s): 1f07a32

Update tests.py

Browse files
Files changed (1) hide show
  1. tests.py +9 -1
tests.py CHANGED
@@ -205,7 +205,15 @@ def create_code_files(filename: str, code) -> dict:
205
  return {"info":"The referenced code files were created successfully."}
206
 
207
  else:
208
- return {"info":"The referenced code files already exist. Please rename the file or delete the existing one."}
 
 
 
 
 
 
 
 
209
 
210
 
211
  @mcp.tool()
 
205
  return {"info":"The referenced code files were created successfully."}
206
 
207
  else:
208
+ if isinstance(code, dict):
209
+ with open(os.path.join(destination_dir, filename), 'w', encoding='utf-8') as f:
210
+ json.dump(code, f, ensure_ascii=False, indent=4)
211
+ else:
212
+ f = open(os.path.join(destination_dir, filename), "w")
213
+ f.write(str(code))
214
+ f.close()
215
+ return {"info":"The referenced code files were created successfully."}
216
+ # return {"info":"The referenced code files already exist. Please rename the file or delete the existing one."}
217
 
218
 
219
  @mcp.tool()