ssh_execute
Execute shell commands on remote servers via SSH with captured stdout, stderr, and exit codes for system administration and automation tasks.
Instructions
Execute a command on the remote server via SSH.
This tool runs a shell command on the connected server and captures stdout, stderr, and exit code. The command runs in a non-interactive shell.
Args: params (ExecuteInput): Validated input parameters containing: - session_id (str): SSH session identifier from ssh_connect - command (str): Command to execute on remote server (e.g., "ls -la", "whoami", "cat /etc/os-release") - working_directory (Optional[str]): Working directory for command execution (e.g., "/var/log") - timeout (int): Execution timeout in seconds, default 30, range 1-600 - response_format (ResponseFormat): Output format (markdown or json)
Returns: str: Command execution result with stdout, stderr, and exit code
Examples: - Use when: "Check what Linux distribution is running" -> params with command="cat /etc/os-release" - Use when: "List files in /var/log" -> params with command="ls -la /var/log" - Use when: "Check disk usage" -> params with command="df -h" - Don't use when: Need interactive commands (e.g., vim, top - use non-interactive alternatives) - Don't use when: Need to run multiple commands in sequence (execute tools separately)
Error Handling: - Returns "Error: Session not found" if session_id is invalid - Returns execution result with non-zero exit code if command fails - Returns timeout error if command exceeds timeout limit
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |