Skip to main content
Glama

ssh_send_input

Send commands or text to an interactive SSH shell session, optionally simulating human typing for automation scripts or remote management tasks.

Instructions

Send input to an interactive shell session with optional typing simulation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesInteractive session ID
inputYesInput to send to the shell
simulateTypingNoSimulate human typing with delays

Implementation Reference

  • The handler function for 'ssh_send_input' tool. It validates input parameters using SendInputSchema, retrieves the active shell session by sessionId, sends the input to the SSH shell (optionally simulating human typing with delays), and returns a confirmation message.
    private async handleSendInput(args: unknown) {
      const params = SendInputSchema.parse(args);
      
      const session = shellSessions.get(params.sessionId);
      if (!session) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Session ID '${params.sessionId}' not found`
        );
      }
    
      if (!session.isActive) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Session '${params.sessionId}' is not active`
        );
      }
    
      try {
        if (params.simulateTyping) {
          // Simulate human typing with random delays
          for (const char of params.input) {
            session.shell.write(char);
            // Random delay between 50-150ms per character
            await new Promise(resolve => setTimeout(resolve, 50 + Math.random() * 100));
          }
        } else {
          session.shell.write(params.input);
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `Input sent to session '${params.sessionId}'${params.simulateTyping ? ' (with typing simulation)' : ''}\nInput: ${params.input}`,
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to send input: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Zod schema defining the input parameters for the 'ssh_send_input' tool: sessionId (required), input (required), simulateTyping (optional boolean). Used for validation in the handler.
    const SendInputSchema = z.object({
      sessionId: z.string().describe('Interactive session ID'),
      input: z.string().describe('Input to send to the shell'),
      simulateTyping: z.boolean().default(false).describe('Simulate human typing with delays')
    });
  • src/index.ts:335-346 (registration)
    Tool registration in the ListTools response. Defines the name, description, and inputSchema for 'ssh_send_input', making it discoverable by MCP clients.
      name: 'ssh_send_input',
      description: 'Send input to an interactive shell session with optional typing simulation',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: { type: 'string', description: 'Interactive session ID' },
          input: { type: 'string', description: 'Input to send to the shell' },
          simulateTyping: { type: 'boolean', default: false, description: 'Simulate human typing with delays' }
        },
        required: ['sessionId', 'input']
      },
    },
  • src/index.ts:499-500 (registration)
    Dispatch/registration in the CallToolRequestSchema handler switch statement, routing calls to the handleSendInput method.
    case 'ssh_send_input':
      return await this.handleSendInput(args);
Behavior2/5

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

With no annotations, the description carries full burden. It mentions 'typing simulation' as an optional behavior, which adds some context, but doesn't disclose critical traits like whether this is a read-only or destructive operation, potential side effects, error handling, or response format. For a tool that sends input to a shell (potentially affecting system state), this is a significant gap.

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, efficient sentence that front-loads the core purpose ('Send input to an interactive shell session') and adds an optional feature ('with optional typing simulation'). Every word earns its place with no redundancy or fluff.

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?

Given no annotations and no output schema, the description is incomplete for a tool that interacts with shell sessions. It doesn't explain what happens after sending input (e.g., how to read output with ssh_read_output), error conditions, or behavioral implications. For a 3-parameter tool with potential system impact, more context is needed.

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 the schema fully documents all parameters. The description adds minimal value beyond the schema by hinting at the purpose of 'simulateTyping' but doesn't provide additional syntax, format, or usage details. Baseline 3 is appropriate when the schema does the heavy lifting.

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 the action ('Send input') and target ('to an interactive shell session'), distinguishing it from sibling tools like ssh_execute (non-interactive) and ssh_read_output (receiving output). It specifies the interactive nature, which is a key differentiator.

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 implies usage for interactive sessions but doesn't explicitly state when to use this vs. alternatives like ssh_execute for non-interactive commands or prerequisites like needing an active session from ssh_start_interactive_shell. It provides some context but lacks explicit guidance on alternatives or 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/mahathirmuh/mcp-ssh-server'

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