Skip to main content
Glama
bvisible

MCP SSH Manager

ssh_execute_group

Execute commands simultaneously on multiple servers via SSH. Choose parallel, sequential, or rolling execution strategies with configurable error handling and working directories.

Instructions

Execute command on a group of servers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupYesGroup name (e.g., "production", "staging", "all")
commandYesCommand to execute
strategyNoExecution strategy
delayNoDelay between servers in ms (for rolling)
stopOnErrorNoStop execution on first error
cwdNoWorking directory

Implementation Reference

  • The tool 'ssh_execute_group' is listed in the TOOL_GROUPS.advanced array, indicating its categorization and registration point for conditional enabling.
    advanced: [
      'ssh_deploy',
      'ssh_execute_sudo',
      'ssh_alias',
      'ssh_command_alias',
      'ssh_hooks',
      'ssh_profile',
      'ssh_connection_status',
      'ssh_tunnel_create',
      'ssh_tunnel_list',
      'ssh_tunnel_close',
      'ssh_key_manage',
      'ssh_execute_group',
      'ssh_group_manage',
      'ssh_history'
    ]
  • Defines the execution strategies used by the group execution tool: parallel, sequential, and rolling.
    export const EXECUTION_STRATEGIES = {
      PARALLEL: 'parallel',      // Execute on all servers at once
      SEQUENTIAL: 'sequential',  // Execute one by one
      ROLLING: 'rolling'        // Execute with delay between servers
    };
  • Core helper function that executes the provided executor function across all servers in a specified group, supporting multiple strategies, delays, error handling, and comprehensive result reporting. This is the primary logic for ssh_execute_group tool.
    async executeOnGroup(groupName, executor, options = {}) {
      const group = this.getGroup(groupName);
      const results = [];
      const strategy = options.strategy || group.strategy || EXECUTION_STRATEGIES.PARALLEL;
      const delay = options.delay || group.delay || 0;
      const stopOnError = options.stopOnError !== undefined ? options.stopOnError : group.stopOnError;
    
      logger.info('Executing on server group', {
        group: groupName,
        servers: group.servers.length,
        strategy,
        delay
      });
    
      switch (strategy) {
      case EXECUTION_STRATEGIES.PARALLEL: {
        // Execute on all servers simultaneously
        const promises = group.servers.map(async (server) => {
          try {
            const result = await executor(server);
            return { server, success: true, result };
          } catch (error) {
            logger.error(`Execution failed on ${server}`, { error: error.message });
            return { server, success: false, error: error.message };
          }
        });
    
        const parallelResults = await Promise.all(promises);
        results.push(...parallelResults);
        break;
      }
    
      case EXECUTION_STRATEGIES.SEQUENTIAL:
      case EXECUTION_STRATEGIES.ROLLING:
        // Execute one by one
        for (const server of group.servers) {
          try {
            const result = await executor(server);
            results.push({ server, success: true, result });
    
            // Add delay for rolling strategy
            if (strategy === EXECUTION_STRATEGIES.ROLLING && delay > 0) {
              logger.debug(`Waiting ${delay}ms before next server`);
              await new Promise(resolve => setTimeout(resolve, delay));
            }
          } catch (error) {
            logger.error(`Execution failed on ${server}`, { error: error.message });
            results.push({ server, success: false, error: error.message });
    
            // Stop on error if configured
            if (stopOnError) {
              logger.warn('Stopping execution due to error', { server });
              break;
            }
          }
        }
        break;
    
      default:
        throw new Error(`Unknown execution strategy: ${strategy}`);
      }
    
      // Summary
      const successful = results.filter(r => r.success).length;
      const failed = results.filter(r => !r.success).length;
    
      logger.info('Group execution completed', {
        group: groupName,
        successful,
        failed,
        total: results.length
      });
    
      return {
        group: groupName,
        strategy,
        results,
        summary: {
          total: results.length,
          successful,
          failed
        }
      };
    }
  • Convenience export for executeOnGroup function, allowing direct usage from other modules including potential tool handlers.
    export const executeOnGroup = (name, executor, options) => serverGroups.executeOnGroup(name, executor, options);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'execute command' implies a potentially destructive operation, it doesn't clarify security implications, permission requirements, error handling beyond the 'stopOnError' parameter, or what happens when servers in the group fail. This leaves significant gaps for a tool that performs remote execution.

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 core functionality and appropriately sized for what it communicates.

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 potentially destructive remote execution tool with 6 parameters and no annotations or output schema, the description is inadequate. It doesn't address safety considerations, expected output format, error scenarios, or how results from multiple servers are aggregated—critical context missing for proper tool invocation.

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?

The schema has 100% description coverage, providing good documentation for all 6 parameters. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

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 verb ('execute command') and resource ('on a group of servers'), making the purpose immediately understandable. However, it doesn't explicitly distinguish this tool from its sibling 'ssh_execute' (which presumably executes on a single server), missing an opportunity for full differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives like 'ssh_execute' (for single servers) or other SSH-related tools. There's no mention of prerequisites, typical use cases, or constraints that would help an agent choose appropriately.

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

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