Skip to main content
Glama

write_file

Writes content to a remote file over SSH, with sudo for privileged writes, SFTP fallback, append mode, and directory creation.

Instructions

Write content to a remote file over SSH.

If use_sudo is True or sudo_password is provided, uses sudo via shell commands (tee). Otherwise, attempts to write using SFTP.

Args: host: Hostname, IP address, or SSH config alias remote_path: Path to the remote file content: Content to write username: SSH username (optional) password: SSH password (optional) key_filename: Path to SSH key file (optional) port: SSH port (optional) encoding: Text encoding (default: utf-8) errors: Error handling for encoding (default: strict) append: Append to file instead of overwriting (default: False) make_dirs: Create parent directories if they don't exist (default: False) permissions: Octal file permissions to set (e.g., 420 for 0644) max_bytes: Maximum bytes to write (default: 2MB) sudo_password: Password for sudo (optional, not needed if NOPASSWD configured) use_sudo: Use sudo for writing (tries passwordless if no sudo_password provided)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
portNo
appendNo
errorsNostrict
contentYes
encodingNoutf-8
passwordNo
use_sudoNo
usernameNo
make_dirsNo
max_bytesNo
permissionsNo
remote_pathYes
key_filenameNo
sudo_passwordNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It transparently explains key behaviors: sudo usage conditions, SFTP fallback, append vs overwrite, directory creation, permission setting, and byte limit. It does not cover failure modes or error handling details, but the disclosed information is substantial and accurate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is longer than ideal but well-structured: a clear one-sentence summary followed by a tabular Args list. Every line in the Args section is informative, though some entries merely restate the schema defaults. The front-loaded purpose statement ensures the most important information appears early.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 15 parameters and no output schema details provided, the description covers the main operational modes (sudo vs SFTP), parameter meanings, and common options. It does not mention prerequisites like SSH connectivity or how existing files are handled beyond append, but given the complexity and presence of an output schema, the description is reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must compensate. The Args section provides a concise one-line explanation for every parameter, including the often subtle 'sudo_password' behavior (not needed if NOPASSWD configured) and defaults like 'errors' and 'encoding'. This adds real semantic value beyond the bare schema properties.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource statement: "Write content to a remote file over SSH." This clearly distinguishes the tool from siblings like read_file and execute_command, and the rest of the description reinforces this purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains how the tool behaves (e.g., SFTP vs sudo via tee) but does not provide explicit guidance on when to choose this tool over alternatives such as execute_command or read_file. Usage is implied by the tool's name and opening line, but no exclusions or alternative comparisons are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/DBeidachazi/mcp-ssh'

If you have feedback or need assistance with the MCP directory API, please join our Discord server