MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / tool_patch_file

Function tool_patch_file

tools/file_tools.py:156–171  ·  view source on GitHub ↗

Patch file content (replace old_str with new_str). Args: path: Path to file old_str: String to find and replace new_str: Replacement string Returns: Diff of changes or error message

(path: str, old_str: str, new_str: str)

Source from the content-addressed store, hash-verified

154
155
156def tool_patch_file(path: str, old_str: str, new_str: str) -> str:
157 """
158 Patch file content (replace old_str with new_str).
159
160 Args:
161 path: Path to file
162 old_str: String to find and replace
163 new_str: Replacement string
164
165 Returns:
166 Diff of changes or error message
167 """
168 try:
169 return _get_fs().patch(path, old_str, new_str)
170 except FilesystemAccessError as e:
171 return f"[ERROR] {e}"
172
173
174def tool_append_file(path: str, content: str) -> str:

Callers

nothing calls this directly

Calls 2

_get_fsFunction · 0.85
patchMethod · 0.80

Tested by

no test coverage detected