<tools>
  <tool name="execute_shell">
    <description>Execute a shell command in a subprocess and return the output.
Use this tool when you need to run system commands, manage files, interact with command-line tools, or perform system operations.</description>
    <details>This tool executes shell commands using subprocess with configurable timeout.
Important notes:
- Commands run through the system shell (/bin/sh or cmd.exe)
- Captures both stdout and stderr
- Default timeout is 30 seconds
- Returns stdout, stderr, and return code
- Supports piping, redirection, and other shell features

    Security considerations:
    - Commands execute with the same permissions as the agent process
    - Be extremely careful with destructive operations (rm, del, etc.)
    - Avoid executing untrusted commands
    - Commands will affect the actual system (not sandboxed)
    - Use absolute paths when possible for clarity</details>
<parameters>
    <parameter name="command" type="string" required="true">
        <description>The shell command to execute. Can include pipes, redirections, and other shell syntax.</description>
    </parameter>
    <parameter name="timeout" type="integer" required="false">
        <description>Maximum execution time in seconds. Default is 300 seconds. Use higher values for long-running commands.</description>
    </parameter>
    <parameter name="cwd" type="string" required="false">
        <description>The working directory in which to execute the command. If not specified, defaults to the current working directory of the agent.</description>
    </parameter>
</parameters>
<returns type="Dict[str, Any]">
    <description>Response containing:
        - success: Whether the command executed successfully (return code 0)
        - message: Status message
        - Dictionary with stdout, stderr, and return_code</description>
</returns>
<examples>
    # List files
    <function=execute_shell>
    <parameter=command>ls -la</parameter>
</function>

        # Check disk space
<function=execute_shell>
<parameter=command>df -h</parameter>
        </function>

        # Using pipes
<function=execute_shell>
<parameter=command>cat /etc/hosts | grep localhost</parameter>
        </function>

        # With custom timeout
<function=execute_shell>
<parameter=command>sleep 5 && echo "Done waiting"</parameter>
<parameter=timeout>10</parameter>
        </function>

        # Create directory structure
<function=execute_shell>
<parameter=command>mkdir -p project/{src,tests,docs} && ls -R project</parameter>
        </function>

        # Git operations
        <function=execute_shell>
        <parameter=command>git status</parameter>
        </function>

        # Execute in a specific directory
        <function=execute_shell>
        <parameter=command>ls -la</parameter>
        <parameter=cwd>/app/AIG-PromptSecurity</parameter>
        </function>
    </examples>
  </tool>
</tools>
