Skip to main content
Glama

write_file

Creates or overwrites a file at a relative path inside the sandbox /workspace directory, with path traversal checks to block unsafe access.

Instructions

Safely creates or overwrites a file at a relative path inside the sandbox /workspace directory. Includes path traversal security checks.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sandboxId": "<sandboxId>",
      "path": "<path>",
      "content": "<content>"
    },
    "name": "write_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesRelative path inside /workspace (e.g. "src/index.js")
contentYesText content to write
sandboxIdYesSandbox ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose two important traits: existing files are overwritten, and path traversal protections are applied. It omits behavior an agent would want for a mutation tool — whether parent directories are created, what happens on failure, encoding or size limits, and what (if anything) is returned.

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

Conciseness5/5

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

Two short sentences with no filler; the writing action and its scope are front-loaded, and the security note follows as supporting context. Every clause earns its place.

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

Completeness3/5

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

There is no output schema and no annotations, so the description should ideally state what the call returns on success or failure, and it does not. It covers purpose, scope, overwrite semantics, and security, which is enough to call the tool correctly but leaves return behavior and failure modes undocumented.

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

Parameters3/5

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

Schema description coverage is 100%, so all three parameters are already documented, establishing a baseline of 3. The description reinforces the relative-path constraint and clarifies that content is text, but adds no syntax, formatting, or edge-case detail beyond the schema.

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

Purpose4/5

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

Specific verb pair ('creates or overwrites') plus a specific resource ('a file') and an explicit scope ('relative path inside the sandbox /workspace directory'). An agent can immediately tell this apart from read_file or execute_command without opening a schema. It stops short of a 5 only because it never names an alternative for cases where a different tool might write content.

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?

Usage is implied by the stated scope: write a file at a relative path inside /workspace. There is no explicit when-to-use versus when-not guidance and no mention of routing alternatives such as execute_command for shell-based writes. Adequate minimum-viable context, but inference is required.

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