MCPcopy
hub / github.com/showlab/computer_use_ootb / write_file

Method write_file

computer_use_demo/tools/edit.py:262–267  ·  view source on GitHub ↗

Write the content of a file to a given path; raise a ToolError if an error occurs.

(self, path: Path, file: str)

Source from the content-addressed store, hash-verified

260 raise ToolError(f"Ran into {e} while trying to read {path}") from None
261
262 def write_file(self, path: Path, file: str):
263 """Write the content of a file to a given path; raise a ToolError if an error occurs."""
264 try:
265 path.write_text(file)
266 except Exception as e:
267 raise ToolError(f"Ran into {e} while trying to write to {path}") from None
268
269 def _make_output(
270 self,

Callers 4

__call__Method · 0.95
str_replaceMethod · 0.95
insertMethod · 0.95
undo_editMethod · 0.95

Calls 1

ToolErrorClass · 0.85

Tested by

no test coverage detected