(self, arguments: ToolCallArguments, _path: Path)
| 374 | return ToolExecResult(output=f"File created successfully at: {_path}") |
| 375 | |
| 376 | def _str_replace_handler(self, arguments: ToolCallArguments, _path: Path) -> ToolExecResult: |
| 377 | old_str = arguments.get("old_str") if "old_str" in arguments else None |
| 378 | if not isinstance(old_str, str): |
| 379 | return ToolExecResult( |
| 380 | error="Parameter `old_str` is required and should be a string for command: str_replace", |
| 381 | error_code=-1, |
| 382 | ) |
| 383 | new_str = arguments.get("new_str") if "new_str" in arguments else None |
| 384 | if not (new_str is None or isinstance(new_str, str)): |
| 385 | return ToolExecResult( |
| 386 | error="Parameter `new_str` should be a string or null for command: str_replace", |
| 387 | error_code=-1, |
| 388 | ) |
| 389 | return self.str_replace(_path, old_str, new_str) |
| 390 | |
| 391 | def _insert_handler(self, arguments: ToolCallArguments, _path: Path) -> ToolExecResult: |
| 392 | insert_line = arguments.get("insert_line") if "insert_line" in arguments else None |
no test coverage detected