MCPcopy Create free account
hub / github.com/bytedance/trae-agent / _insert_handler

Method _insert_handler

trae_agent/tools/edit_tool_cli.py:391–404  ·  view source on GitHub ↗
(self, arguments: ToolCallArguments, _path: Path)

Source from the content-addressed store, hash-verified

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
393 if not isinstance(insert_line, int):
394 return ToolExecResult(
395 error="Parameter `insert_line` is required and should be integer for command: insert",
396 error_code=-1,
397 )
398 new_str_to_insert = arguments.get("new_str") if "new_str" in arguments else None
399 if not isinstance(new_str_to_insert, str):
400 return ToolExecResult(
401 error="Parameter `new_str` is required for command: insert",
402 error_code=-1,
403 )
404 return self._insert(_path, insert_line, new_str_to_insert)
405
406
407def main():

Callers 2

executeMethod · 0.95
mainFunction · 0.95

Calls 2

_insertMethod · 0.95
ToolExecResultClass · 0.70

Tested by

no test coverage detected