serena.tools.cmd_tools#
Source code: serena/tools/cmd_tools.py
Tools supporting the execution of (external) commands
- class ExecuteShellCommandTool(agent)[source]#
Bases:
Tool,ToolMarkerCanEditExecutes a shell command.
- Parameters:
agent (SerenaAgent)
- apply(
- command,
- cwd=None,
- capture_stderr=True,
- max_answer_chars=-1,
Execute a shell command and return its output. If there is a memory about suggested commands, read that first. Never execute unsafe shell commands! IMPORTANT: Do not use this tool to start
long-running processes (e.g. servers) that are not intended to terminate quickly,
processes that require user interaction.
- Parameters:
command (str) – the shell command to execute
cwd (str | None) – the working directory to execute the command in. If None, the project root will be used.
capture_stderr (bool) – whether to capture and return stderr output
max_answer_chars (int) – if the output is longer than this number of characters, no content will be returned. -1 means using the default value, don’t adjust unless there is no other way to get the content required for the task.
- Returns:
a JSON object containing the command’s stdout and optionally stderr output
- Return type:
str