Skip to main content
Glama
d3v1an
by d3v1an

ssh_shell_read

Read accumulated shell output from SSH sessions with configurable wait time for additional data before returning results.

Instructions

Lee el output acumulado en el buffer de una sesión de shell. Espera brevemente por output adicional antes de retornar

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID de la sesión de shell
timeoutNoTiempo en ms para esperar output adicional (default: 2000)

Implementation Reference

  • Implementation of the handleShellRead function which reads the accumulated shell output from the session buffer.
    private async handleShellRead(args: any): Promise<CallToolResult> {
      this.requireConnection();
      const sessionId = args.sessionId as string;
      const timeout = (args.timeout as number) || SSHMCPServer.SETTLE_TIMEOUT;
    
      const session = this.shellSessions.get(sessionId);
      if (!session) {
        throw new Error(`Sesión "${sessionId}" no encontrada.`);
      }
    
      // Esperar output adicional
      return new Promise<CallToolResult>((resolve) => {
        setTimeout(() => {
          const output = session.buffer;
          session.buffer = "";
          resolve({
            content: [
              {
                type: "text",
                text: stripAnsi(output) || "(sin output nuevo)",
              },
            ],
          });
        }, timeout);
      });
    }
  • Tool schema definition for ssh_shell_read, including input parameters.
    {
      name: "ssh_shell_read",
      description:
        "Lee el output acumulado en el buffer de una sesión de shell. Espera brevemente por output adicional antes de retornar",
      inputSchema: {
        type: "object",
        properties: {
          sessionId: {
            type: "string",
            description: "ID de la sesión de shell",
          },
          timeout: {
            type: "number",
            description: "Tiempo en ms para esperar output adicional (default: 2000)",
          },
        },
        required: ["sessionId"],
      },
    },
  • src/index.ts:83-84 (registration)
    Routing case for ssh_shell_read in the main tool handler.
    case "ssh_shell_read":
      return await this.handleShellRead(args);

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

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