Skip to main content
Glama

Write file

write_file
Destructive

Create or overwrite files securely within an allowed directory, with options to create parent folders and append content.

Instructions

Create or overwrite a file inside an allowed root. createDirectories mkdir -p the parent. append adds to an existing file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or ~ path to write
appendNo
contentYesFile contents (text or base64)
encodingNoHow to interpret contentutf8
createDirectoriesNo
Behavior4/5

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

Annotations already declare destructiveHint=true, but the description adds meaningful behavioral context beyond that: it explains that 'createDirectories mkdir -p the parent' and 'append adds to an existing file', which are not covered by annotations. It also clarifies the overwrite semantics, consistent with the destructive hint. This improves the agent's understanding of side effects.

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 three short sentences, with the primary purpose front-loaded. It avoids redundancy with the schema and uses compact phrasing. The only minor issue is the cryptic 'mkdir -p the parent' idiom, which could be clearer, but overall it is efficient and to the point.

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 file-write tool with destructive annotations and a schema covering most parameters, the description covers the essential behaviors: overwrite, allowed-root scoping, parent-directory creation, and append mode. There is no output schema, so return values aren't expected. It doesn't address error handling or permission details, but these are not essential given the other structured support. It is adequately complete.

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 coverage is only 60% (path, content, encoding are documented; append and createDirectories are not). The description fills that gap by explaining 'createDirectories mkdir -p the parent' and 'append adds to an existing file', clarifying the two undocumented parameters. It doesn't add anything for the already-documented parameters, but it effectively compensates for the coverage shortfall.

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 'Create or overwrite a file', giving a specific verb and resource, and adds a critical scoping constraint ('inside an allowed root') that distinguishes it from sibling tools like write_clipboard or read_file. It clearly identifies this as a file-write operation.

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

Usage Guidelines2/5

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

The description states what the tool does but gives no explicit guidance on when to use it versus alternatives. It does mention the allowed-root constraint, which is relevant context, but it doesn't say when not to use it (e.g., 'use read_file to read') or provide any exclusion criteria. The intended use case must be inferred.

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/jameymcelveen/desktop-bridge'

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