Skip to main content
Glama

ssh_run_command

Destructive

Execute shell commands on remote SSH hosts and capture output with exit codes. Supports sudo, environment variables, and custom working directories.

Instructions

Execute a shell command on a remote SSH host and return the output.

The command runs in the login user's default shell. Both stdout and stderr are captured and returned. The exit code is included so you can detect failures.

Args: alias: Target host alias. command: Shell command to execute (e.g., 'ls -la /var/log', 'systemctl status nginx', 'df -h'). timeout: Maximum seconds to wait (default 60, max 3600). env: Optional extra environment variables dict for this command. cwd: Remote working directory. When set the effective invocation becomes 'cd && '. Use absolute POSIX paths (e.g. '/var/www/html'). State is NOT persisted between calls. sudo_password: When set, the command runs via sudo. The password is never echoed back in output. response_format: 'markdown' (default, human-readable) or 'json'.

Returns: Command output (stdout + stderr) with exit code.

Examples: - Inspect disk usage: command='df -h' - Check a service: command='systemctl status nginx' - Tail logs: command='tail -n 50 /var/log/syslog' - Install a package: command='sudo apt-get install -y htop'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYes
commandYes
timeoutNo
envNo
cwdNo
sudo_passwordNo
response_formatNomarkdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Describes exit code, stdout/stderr capture, sudo behavior, and non-persistent cwd state. Annotations already include destructiveHint=true; description adds useful context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with Args, Returns, Examples. Front-loaded with purpose. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Comprehensive for a command execution tool: explains return values, timeout limits, response_format options, and provides multiple examples. Output schema exists but description covers key behavioral aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema coverage, description provides detailed explanations for all 7 parameters, including constraints, defaults, and examples (e.g., timeout max 3600, cwd usage).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Execute a shell command on a remote SSH host and return the output.' Differentiates from sibling tools like ssh_add_host or ssh_list_directory.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implicitly defines usage via examples and sibling context; lacks explicit when-not-to-use or alternatives, but purpose is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/muradmalik23/sshand'

If you have feedback or need assistance with the MCP directory API, please join our Discord server