Skip to main content
Glama

Write a file

sandbox_write_file
Idempotent

Write a file. Writes a file in the sandbox (text, or base64 for bytes), making its folders. Replaces a file already there. At most 10 MB.

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>",
      "content": "<content>",
      "path": "<path>"
    },
    "name": "sandbox_write_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute, or relative to the sandbox's home directory.
contentYesThe file's content, as text or base64 (see `encoding`).
encodingNoutf-8
sandboxIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

The description adds real context beyond the annotations: it discloses that parent folders are created, that an existing file is replaced, and that payloads are capped at 10 MB. The only soft spot is that 'Replaces a file already there' sits in mild tension with destructiveHint=false, since overwriting discards prior content; this deserves noting but is not a hard inconsistency.

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?

Roughly thirty words in four front-loaded sentences, with the size limit and overwrite behavior placed where an agent will read them. The opening 'Write a file. Writes a file in the sandbox' is mildly redundant, costing a point but not impairing scanning.

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 simple write tool with no output schema and annotations that already declare safety and idempotency, the description covers the operationally important facts: encoding mode, folder creation, overwrite semantics, and the 10 MB ceiling. It does not say what the call returns or whether a write can fail on size or permission grounds, which is a minor remaining gap.

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 coverage is 50%, and the description compensates for part of the gap by explaining that content can be text or base64 ('text, or base64 for bytes'), which gives meaning to the encoding parameter. However, sandboxId remains undocumented in both schema and description, and path semantics (absolute vs sandbox home) live only in 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?

The description uses a specific verb+resource ('Write a file... Writes a file in the sandbox') and scopes it further with text-vs-base64 content and parent-folder creation. It is clearly distinguishable from sibling read/delete operations by name alone, but it never explicitly contrasts itself with them.

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 rather than stated: an agent infers this is the tool for creating or overwriting file content rather than reading it (sandbox_read_file) or removing it (sandbox_delete), but there is no explicit when-to-use or when-not guidance, and no mention of precedence against sandbox_exec for content generation.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.