ssh_read_file
Read the content of a file on a remote server via SSH to access configuration files, logs, or documents without direct server login.
Instructions
Lee el contenido de un archivo en el servidor remoto
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Ruta del archivo a leer en el servidor remoto |
Implementation Reference
- src/index.ts:364-380 (handler)The handler function that executes the `ssh_read_file` logic by executing a `cat` command on the remote server via SSH.
private async handleReadFile(args: any): Promise<CallToolResult> { this.requireConnection(); const remotePath = args.path as string; try { const content = await this.execCommand(`cat ${escapeShellArg(remotePath)}`); this.audit("ssh_read_file", remotePath, "ok"); this.recordOperation("ssh_read_file", { path: remotePath }, `(${content.length} bytes leídos)`, false); return { content: [{ type: "text", text: content }], }; } catch (error) { this.audit("ssh_read_file", remotePath, "error"); const msg = error instanceof Error ? error.message : String(error); throw new Error(`Error leyendo archivo "${remotePath}": ${msg}`); } } - src/tools.ts:112-124 (schema)Schema definition and registration for the `ssh_read_file` tool.
name: "ssh_read_file", description: "Lee el contenido de un archivo en el servidor remoto", inputSchema: { type: "object", properties: { path: { type: "string", description: "Ruta del archivo a leer en el servidor remoto", }, }, required: ["path"], }, },