Skip to main content
Glama

write_file

Write content to a remote file over SSH, with support for sudo or SFTP, configurable encoding, appending, directory creation, and permissions.

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
remote_pathYes
contentYes
usernameNo
passwordNo
key_filenameNo
portNo
encodingNoutf-8
errorsNostrict
appendNo
make_dirsNo
permissionsNo
max_bytesNo
sudo_passwordNo
use_sudoNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations, the description carries the full burden. It explains the sudo/SFTP mechanism, append, make_dirs, permissions, and max_bytes. However, it omits details on error handling, side effects of overwriting, or connection behavior.

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 front-loaded with the purpose, followed by a structured argument list. It is not overly verbose but lengthy due to many parameters; every line adds value.

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?

Given 15 parameters and an output schema, the description covers core behavior and parameter details. It mentions max_bytes and permissions. Could be more complete on error handling, but overall adequate for the complexity.

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

Parameters4/5

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

Schema description coverage is 0%, but the description lists all 15 parameters with explanatory text (e.g., 'permissions: Octal file permissions to set (e.g., 420 for 0644)'), adding significant meaning beyond the schema.

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 starts with 'Write content to a remote file over SSH,' which clearly states the action (write) and resource (remote file). This distinguishes it from siblings like read_file and execute_command.

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

Usage Guidelines4/5

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

The description explains when to use sudo vs SFTP based on use_sudo and sudo_password. However, it does not explicitly exclude other use cases or compare with alternatives like execute_command for writing.

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

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