Skip to main content
Glama

write_file

Create or overwrite a file (up to 3 MiB). Send text as-is, or bytes as base64 with encoding='base64'. Counts against the workspace owner's storage cap. 0.74.0: when the file's header names a convention and the file breaks one of that convention's own checks, the answer carries flagged with the reason; the file is saved all the same. 0.76.0: a file with convention: agreement and subject: <workspace_id>/<path>@<version> is your agreement to that version of a deal or decision here, exactly as agree makes it: the answer carries agreed when it counts, flagged with the reason when it doesn't.

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": {
      "workspace_id": "<workspace_id>",
      "path": "<path>",
      "content": "<content>"
    },
    "name": "write_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesWhere to save the file, like 'drafts/report.md'. An existing file is overwritten (its history is kept).
contentYesThe file's content: text as-is, or bytes as base64 (then set encoding='base64').
encodingNo'text' (default) or 'base64' for binary content.text
api_tokenNoYour hashn API token, if you can't send it as the 'Authorization: Bearer <token>' header. Omit it when the header is set.
content_typeNoThe file's media type, e.g. 'text/markdown' or 'image/png'. Optional.
workspace_idYesThe workspace's id (a UUID), from create_workspace, list_workspaces or the store.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / api_token / description
      Added value: +"Your hashn API token, if you can't send it as the 'Authorization: Bearer <token>' header. Omit it when the header is set."
    • addedInput schema / properties / content / description
      Added value: +"The file's content: text as-is, or bytes as base64 (then set encoding='base64')."
    • addedInput schema / properties / content_type / description
      Added value: +"The file's media type, e.g. 'text/markdown' or 'image/png'. Optional."
    • addedInput schema / properties / encoding / description
      Added value: +"'text' (default) or 'base64' for binary content."
    • addedInput schema / properties / path / description
      Added value: +"Where to save the file, like 'drafts/report.md'. An existing file is overwritten (its history is kept)."
    • addedInput schema / properties / workspace_id / description
      Added value: +"The workspace's id (a UUID), from create_workspace, list_workspaces or the store."
  2. First observed

TDQS

A4.2/5.0
Behavior5/5

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

Beyond annotations, the description discloses the storage-cap accounting, the hard 3 MiB limit, the crucial behavior that a convention check failure only adds `flagged` and 'the file is saved all the same', and the implicit-agreement semantics with the `agreed` field. These are non-obvious traits an agent could easily get wrong, and none are repeated from the annotations.

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?

It is front-loaded with the core create/overwrite behavior and size limit, then layers encoding, storage, and convention semantics in descending importance. The '0.74.0:' / '0.76.0:' changelog prefixes add noise an agent does not need, keeping it from a 5.

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?

With no output schema, the description partially compensates by naming the `flagged` and `agreed` response fields and their meaning, and it covers the most consequential write semantics. It remains silent on the rest of the response shape and on auth beyond the api_token parameter that the schema already documents.

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 100%, so the baseline is 3; the description adds meaning the schema does not, notably the 3 MiB content ceiling and the required `subject: <workspace_id>/<path>@<version>` shape for the agreement convention. Other parameters (workspace_id, api_token, content_type) are not illuminated, keeping it out of 5 territory.

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 opening sentence gives a specific verb and resource ('Create or overwrite a file') plus a size ceiling of 3 MiB, so the agent knows exactly what operation and constraint it is getting. It does not name or distinguish itself from any sibling (delete_file, read_file, file_history, agree), so it falls short of a 5.

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?

It gives real conditional guidance: send text as-is, or bytes as base64 'with encoding='base64'', and it explains that a `convention: agreement` header makes the write function as an agreement 'exactly as `agree` makes it', which routes the agent to the alternative. It still never states when NOT to use this tool (for example, when an existing file should be appended or when a dedicated file-creation path is preferred).

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.

Resources