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
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ID de la sesión de shell | |
| timeout | No | Tiempo en ms para esperar output adicional (default: 2000) |
Implementation Reference
- src/index.ts:696-721 (handler)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); }); } - src/tools.ts:242-260 (schema)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);