Skip to main content
Glama

execute_command

Execute commands over SSH with persistent sessions, automatic timeout handling, and support for network devices and sudo access.

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
commandYes
usernameNo
passwordNo
key_filenameNo
portNo
enable_passwordNo
enable_commandNoenable
sudo_passwordNo
timeoutNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description fully describes behavioral traits: persistent sessions, synchronous start with async fallback, timeout handling, interactive support, command interruption, session persistence, automatic sudo prefix, and authentication methods. It is highly transparent.

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 brief overview, detailed parameter list, and bullet-pointed advanced features. It is front-loaded with the core behavior. Some redundancy exists (e.g., 'automatically' used multiple times), but overall it is concise and organized.

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

Completeness4/5

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

Given the tool's complexity (10 parameters, no annotations) and the existence of an output schema (not shown), the description covers input behavior well. It mentions returning a command ID for async mode but does not describe the synchronous output (e.g., stdout/stderr). Assuming the output schema covers return values, completeness is high but with a minor gap.

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?

Schema coverage is 0% (no parameter descriptions in schema). The description provides thorough explanations for all 10 parameters in the 'Args' section, including default values, usage scenarios (host as alias, enable/sudo passwords), and constraints (optional fields). This adds significant meaning beyond the schema.

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

Purpose4/5

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

The description clearly states it executes a command on an SSH host with a persistent session. It explains the synchronous start and potential async transition. However, given the sibling tool 'execute_command_async', the description does not explicitly differentiate when to use this tool vs the explicit async version, limiting clarity.

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

Usage Guidelines3/5

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

The description provides some usage context: synchronous start, automatic async transition on timeout, and when to use enable_password/sudo_password. However, it does not explicitly state when to use this tool over its sibling 'execute_command_async' or when not to use it. The guidance is present but incomplete.

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

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