ssh_file_read
Read file contents directly via SFTP, bypassing shell encoding issues for reliable access on any platform.
Instructions
Read file contents directly via SFTP.
This tool reads raw bytes from the remote file using SFTP and decodes them on the client side. Unlike command-based file reading (cat, Get-Content), SFTP completely bypasses shell and console encoding issues.
Why use this instead of ssh_cmd_run with cat/Get-Content?
Works correctly with Unicode on ALL platforms including Windows
Bypasses Windows PowerShell's OEM code page encoding problem
More efficient for binary-safe file transfer
No shell escaping issues with special characters in content
Returns: Dictionary with: - success: True if file was read successfully - content: The file contents as a string - size: Number of bytes read - encoding: The encoding used to decode the content
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the file to read | |
| encoding | No | Character encoding (default: utf-8) | utf-8 |
| max_size | No | Maximum file size in bytes (default: 10MB, 0 for no limit) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||