Skip to main content
Glama
widjis
by widjis

ssh_send_input

Send commands or text to an active SSH shell session, with optional human-like typing simulation for interactive applications.

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

  • Implements the core logic for sending input to an active SSH interactive shell session. Retrieves the session from the pool, optionally simulates human typing with delays, and writes the input to the shell channel.
    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), and optional simulateTyping flag.
    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:334-346 (registration)
    Registers the ssh_send_input tool in the MCP server's listTools response, including name, description, and input schema.
    {
      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)
    Dispatches calls to the ssh_send_input tool by invoking the handleSendInput handler in the central CallToolRequestSchema switch statement.
    case 'ssh_send_input':
      return await this.handleSendInput(args);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'optional typing simulation' which hints at behavioral traits (delays), but lacks critical details: whether this requires specific permissions, if input is buffered or immediate, error handling (e.g., invalid sessionId), or side effects (e.g., session state changes). For a tool that interacts with shell sessions, this is a significant gap in transparency.

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 with zero waste—it front-loads the core action ('Send input to an interactive shell session') and adds optional detail ('with optional typing simulation'). Every word earns its place, making it appropriately sized and well-structured for quick comprehension.

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 complexity (interactive shell interaction), no annotations, and no output schema, the description is incomplete. It doesn't explain return values (e.g., success/failure, output handling), error conditions, or dependencies on other tools like ssh_start_interactive_shell. For a tool with behavioral nuances and sibling interactions, this leaves critical gaps for an AI agent.

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 parameters (sessionId, input, simulateTyping). The description adds minimal value beyond the schema—it implies 'typing simulation' relates to simulateTyping but doesn't elaborate on delay behavior or use cases. Baseline 3 is appropriate as the schema does the heavy lifting, though no extra semantic context is provided.

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 ('Send input') and resource ('to an interactive shell session'), specifying the action and target. It distinguishes from siblings like ssh_execute (non-interactive) and ssh_read_output (receiving output), though not explicitly named. However, it doesn't fully differentiate from all siblings like ssh_start_interactive_shell (initiating sessions).

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. It doesn't mention prerequisites (e.g., requiring an active interactive session started via ssh_start_interactive_shell), exclusions (e.g., not for non-interactive commands), or comparisons with siblings like ssh_execute for one-off commands. Usage is implied but not explicitly stated.

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

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