ssh_download
Download files from remote SSH servers to local systems using secure connections. Specify server name, remote file path, and local destination path for file transfers.
Instructions
Download file from remote SSH server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server | Yes | Server name | |
| remotePath | Yes | Remote file path | |
| localPath | Yes | Local destination path |
Implementation Reference
- src/tool-registry.js:14-20 (registration)Registration of 'ssh_download' as part of the essential core SSH operations tool group in the centralized TOOL_GROUPS export.core: [ 'ssh_list_servers', 'ssh_execute', 'ssh_upload', 'ssh_download', 'ssh_sync' ],
- src/ssh-manager.js:383-412 (helper)Core file download implementation in SSHManager class. Downloads file from remotePath to localPath using SFTP fastGet, with automatic ~ home directory expansion and error handling. This executes the core logic of the ssh_download tool.async getFile(localPath, remotePath) { // SFTP doesn't resolve ~ automatically, we need to get the real path let resolvedRemotePath = remotePath; if (remotePath.includes('~')) { try { const homeDir = await this.resolveHomePath(); // Replace ~ with the actual home directory // Handle both ~/path and ~ alone if (remotePath === '~') { resolvedRemotePath = homeDir; } else if (remotePath.startsWith('~/')) { resolvedRemotePath = homeDir + remotePath.substring(1); } else { // If ~ is not at the beginning, don't replace it resolvedRemotePath = remotePath; } } catch (err) { // If we can't resolve home, throw a more descriptive error throw new Error(`Failed to resolve home directory for path: ${remotePath}. ${err.message}`); } } const sftp = await this.getSFTP(); return new Promise((resolve, reject) => { sftp.fastGet(resolvedRemotePath, localPath, (err) => { if (err) reject(err); else resolve(); }); }); }