Skip to main content
Glama

runRemoteCommand

Execute shell commands on remote SSH hosts to manage systems, run scripts, or perform administrative tasks securely through the MCP SSH Agent interface.

Instructions

Executes a shell command on an SSH host

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostAliasYesAlias or hostname of the SSH host
commandYesThe shell command to execute

Implementation Reference

  • The main handler function for the 'runRemoteCommand' tool. It connects to the specified SSH host using the SSHClient class, executes the given command remotely, and returns the stdout, stderr, and exit code.
    async runRemoteCommand(hostAlias: string, command: string): Promise<CommandResult> {
      try {
        // First connect to the host
        await this.connectToHost(hostAlias);
    
        // Execute the command
        const result = await this.ssh.execCommand(command);
        
        return {
          stdout: result.stdout,
          stderr: result.stderr,
          code: result.code || 0
        };
      } catch (error) {
        console.error(`Error executing command on ${hostAlias}:`, error);
        return {
          stdout: '',
          stderr: error instanceof Error ? error.message : String(error),
          code: 1
        };
      } finally {
        this.ssh.dispose();
      }
    }
  • Type definition for the output of runRemoteCommand, defining the structure of CommandResult returned by the tool.
    export interface CommandResult {
      stdout: string;
      stderr: string;
      code: number;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions execution but doesn't cover critical aspects like permission requirements, whether commands run interactively or in background, timeout behavior, error handling, or output format. For a potentially dangerous SSH command execution tool, this is insufficient.

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?

The description is a single, clear sentence with zero wasted words. It's front-loaded with the essential information and doesn't contain any unnecessary elaboration or repetition.

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

Completeness2/5

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

For a tool that executes shell commands over SSH (a potentially destructive operation with security implications), the description is inadequate. With no annotations, no output schema, and minimal behavioral context, it leaves too many questions unanswered about how the tool behaves and what to expect from its execution.

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

Parameters3/5

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

Schema description coverage is 100%, so both parameters are documented in the schema. The description doesn't add any additional meaning about parameters beyond what's in the schema descriptions. This meets the baseline for high schema coverage.

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 the action ('executes') and resource ('shell command on an SSH host'), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'runCommandBatch' or 'checkConnectivity', but the verb+resource combination is specific enough for basic understanding.

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

Usage Guidelines2/5

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

No guidance is provided about when to use this tool versus alternatives like 'runCommandBatch' for multiple commands or 'checkConnectivity' for testing connections. The description only states what it does, not when it's appropriate or what prerequisites might exist.

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

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