Skip to main content
Glama

file.write

Writes a file on the daemon host in one call from text, JSON, artifact, or batch results, avoiding shell-chunk echoing; sanitizes file names, creates directories, and handles conflicts.

Instructions

Write a file on the daemon host in one call, instead of echoing content through a shell in chunks. Source is exactly one of content (text, or base64 with encoding), json (pretty-printed), artifact_id, or batch_id (a page.visit_batch run's results, partial if still running). The file name is sanitized for every OS (illegal characters, reserved names like CON, trailing dots, length); the directory must be absolute and is created. on_conflict: "rename" (default, writes "name (2).ext"), "error", or "overwrite" (atomic replace).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "file.write"
  }
}

Input Schema

NameRequiredDescriptionDefault
dirNoAbsolute directory; use with filename.
jsonNo
pathNoAbsolute path. Only the file name part is sanitized.
contentNo
batch_idNo
encodingNo
filenameNoFile name, sanitized before use. Handy when it comes from a page title.
artifact_idNo
on_conflictNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=false and openWorldHint=true, so the description carries the real burden and does it well: it discloses filename sanitization rules (illegal characters, reserved names like CON, trailing dots, length), that the directory must be absolute and is auto-created, and the three conflict modes with their default and atomicity. It never says what is returned (resolved path or sanitized name), which matters given automatic renaming.

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?

Front-loaded with the core purpose, then source options, then sanitization, then conflict handling — a logical order with little waste. The parenthetical lists (reserved names, rename example) are dense but each carries information the schema lacks.

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?

There is no output schema, and the description covers sources, path rules, sanitization and conflict resolution, which is most of what a caller needs. The notable gap is return behavior: with default 'rename' the final filename differs from the requested one, so an agent cannot know where the file landed or how to reference it afterwards.

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 only 33%, so the description compensates well for the source parameters (content with encoding, json pretty-printing, artifact_id, batch_id) and for on_conflict's three values plus default. However, it never clarifies the relationship between 'path' and 'dir'+'filename' (mutually exclusive alternatives) or why zero parameters are required, leaving the agent to infer the addressing rules. Adequate but not complete compensation for a 9-parameter 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?

States a specific verb and resource ('Write a file on the daemon host') and immediately contrasts it with the alternative approach it replaces ('echoing content through a shell in chunks'). An agent can tell this is a single-call file-creation tool without opening the schema.

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?

Gives clear usage context: the source must be exactly one of content/json/artifact_id/batch_id, and batch_id may be partial if the run is still going, which tells the agent it can write mid-run. It does not name sibling tools (e.g. artifact.export) or say when NOT to use this, but the contextual conditions are concrete.

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

Deploy Server

Other Tools