Skip to main content
Glama

execute_command

Execute commands on SSH hosts with persistent sessions, automatic sudo/enable handling, and async timeout transition.

Instructions

Execute a command on an SSH host using a persistent session.

Starts synchronously and waits for completion. If the command doesn't complete within the timeout, it automatically transitions to async mode and returns a command ID for tracking.

The host parameter can be either a hostname/IP or an SSH config alias. If an SSH config alias is provided, configuration will be read from ~/.ssh/config.

For network devices (routers, switches), use enable_password to automatically enter privileged/enable mode before executing commands.

For Unix/Linux hosts requiring sudo, use sudo_password to automatically handle the sudo password prompt. The command will be automatically prefixed with 'sudo' if not already present.

Advanced Features:

  • Automatic timeout handling with async transition

  • Interactive command support with input capability

  • Command interruption (Ctrl+C) for stuck processes

  • Session persistence across multiple commands

Args: host: Hostname, IP address, or SSH config alias (e.g., "myserver") command: Command to execute username: SSH username (optional, will use SSH config or current user) password: Password (optional) key_filename: Path to SSH key file (optional, will use SSH config) port: SSH port (optional, will use SSH config or default 22) enable_password: Enable mode password for network devices (optional) enable_command: Command to enter enable mode (default: "enable") sudo_password: Password for sudo commands on Unix/Linux hosts (optional) timeout: Timeout in seconds for command execution (default: 30)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
portNo
commandYes
timeoutNo
passwordNo
usernameNo
key_filenameNo
sudo_passwordNo
enable_commandNoenable
enable_passwordNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries the full burden and does an excellent job. It discloses automatic async transition after timeout, automatic sudo prefixing, enable mode entry, session persistence, interactive input support, and command interruption. All these are behavioral traits beyond the input schema and are highly relevant for safe and correct invocation.

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

Conciseness4/5

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

The description is well-structured with a front-loaded summary, detailed paragraphs, and a bulleted 'Advanced Features' list. It is somewhat long but every section adds necessary detail for a tool with 10 parameters. Minor redundancy exists between the initial paragraphs and the advanced features list, but overall it is appropriately sized and organized.

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?

The description is comprehensive for a complex tool: it covers all parameters, device-specific behaviors, timeout handling, and advanced features. An output schema exists, so return value details are not required. Given no annotations and high complexity, the description fully equips an agent to use the tool correctly.

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?

The schema provides 0% description coverage for parameters, but the description lists all 10 parameters with clear meanings, defaults, and examples (e.g., host as 'myserver', timeout default 30). It adds substantial value beyond the bare schema, fully compensating for the lack of schema-level descriptions.

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?

The description clearly states 'Execute a command on an SSH host using a persistent session', which is a specific verb+resource. It distinguishes itself from the sibling execute_command_async by explaining the synchronous start and async transition behavior, making its unique role clear.

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?

The description provides usage context for different scenarios: using enable_password for network devices, sudo_password for Unix/Linux hosts, and handling SSH config aliases. It does not explicitly mention alternatives like execute_command_async for non-blocking execution, but the async transition behavior implies when the async sibling would be relevant. Thus it gives clear context but no explicit exclusions.

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/DBeidachazi/mcp-ssh'

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