Skip to main content
Glama
d3v1an
by d3v1an

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
NameRequiredDescriptionDefault
pathNoRuta del directorio a listar (default: directorio home)

Implementation Reference

  • 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)",
          },
        },
      },
    },

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