ssh_ls
List directory contents on a remote SSH server to view files and folders without direct access.
Instructions
Lista el contenido de un directorio en el servidor remoto
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Ruta del directorio a listar (default: directorio home) |
Implementation Reference
- src/index.ts:338-362 (handler)Handler logic for the ssh_ls tool, which lists directory contents using SFTP.
private async handleLs(args: any): Promise<CallToolResult> { this.requireConnection(); const path = (args.path as string) || "."; const sftp = await this.getSftp(); return new Promise<CallToolResult>((resolve, reject) => { sftp.readdir(path, (err, list) => { if (err) { reject(new Error(`Error listando directorio "${path}": ${err.message}`)); return; } const entries = list.map((entry) => { const type = entry.attrs.isDirectory() ? "d" : entry.attrs.isSymbolicLink() ? "l" : "-"; const size = entry.attrs.size; return `${type} ${entry.attrs.uid}:${entry.attrs.gid} ${padRight(String(size), 10)} ${entry.filename}`; }); resolve({ content: [{ type: "text", text: entries.join("\n") || "(directorio vacío)" }], }); }); }); } - src/tools.ts:98-110 (registration)Registration definition and input schema for the ssh_ls tool.
{ name: "ssh_ls", description: "Lista el contenido de un directorio en el servidor remoto", inputSchema: { type: "object", properties: { path: { type: "string", description: "Ruta del directorio a listar (default: directorio home)", }, }, }, },