Skip to main content
Glama

ssh_exec

Execute commands on remote SSH servers through the mcpHydroSSH server to manage and control systems directly from your workflow.

Instructions

Execute a command on an SSH server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesCommand to execute
connectionIdNoConnection ID (optional, uses most recent if not provided)
timeoutNoCommand timeout in milliseconds (optional)
cwdNoWorking directory (optional)

Implementation Reference

  • Handler for the ssh_exec tool which executes commands using the sshManager.
    case 'ssh_exec': {
      const command = args.command as string;
      const connectionId = args.connectionId as string | undefined;
      const timeout = args.timeout as number | undefined;
      const cwd = args.cwd as string | undefined;
      try {
        const result = await sshManager.exec(command, connectionId, { timeout, cwd });
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (err: unknown) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: err instanceof Error ? err.message : String(err) }, null, 2),
            },
          ],
          isError: true,
        };
      }
    }
  • Schema definition for the ssh_exec tool.
      name: 'ssh_exec',
      description: 'Execute a command on an SSH server',
      inputSchema: {
        type: 'object',
        properties: {
          command: {
            type: 'string',
            description: 'Command to execute',
          },
          connectionId: {
            type: 'string',
            description: 'Connection ID (optional, uses most recent if not provided)',
          },
          timeout: {
            type: 'number',
            description: 'Command timeout in milliseconds (optional)',
          },
          cwd: {
            type: 'string',
            description: 'Working directory (optional)',
          },
        },
        required: ['command'],
      },
    },
Behavior2/5

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

No annotations provided, so description carries full burden. Lacks disclosure about return values (stdout/stderr/exit code), streaming behavior, side effects on the remote server, or what happens if the connection drops. 'Execute' implies mutation but specifics are absent.

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

Conciseness3/5

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

Single sentence is efficient but undersized for a 4-parameter tool with complex lifecycle implications. While not wasting words, it fails to front-load critical operational context (prerequisites, output format) that would help an agent invoke this correctly.

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?

Incomplete for a command execution tool lacking annotations and output schema. Missing: prerequisite connection state, return value structure, error conditions, and side effect disclosure. The description only identifies the tool without operational context.

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 baseline 3 is appropriate. The description adds no parameter-specific context, but the schema adequately documents all four parameters including units (milliseconds) and optional behavior.

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?

Uses specific verb 'Execute' with clear resource 'command on an SSH server'. However, it does not clarify whether this requires a pre-existing connection (implied by connectionId parameter but not stated) or how it differs from ssh_connect in the workflow.

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 explicit when-to-use guidance or prerequisites mentioned. Fails to state that an active connection is required (inferred from connectionId parameter) or when to prefer this over ssh_connect. No mention of error handling or timeout considerations.

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/hydroCoderClaud/mcpHydroSSH'

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