Skip to main content
Glama

fs_write_binary

Destructive

Write binary files to your project from Base64 data with atomic replacement and SHA-256 validation. Enforces size limits and supports safe creation or update of files.

Instructions

Write a binary file under the project root from plain Base64 (not a data URL; no remote fetch). Requires lease_id. Line breaks and the URL-safe alphabet are accepted; padding is optional. Decoded size capped at 2_000_000 bytes (coupled with Caddy 4MB body limit). For existing files, expected_sha256 is mandatory (use sha256 from fs_read UNSUPPORTED_BINARY); CONFLICT if the file changed. create=true allows new files (empty expected_sha256). Atomic temp+fsync+replace. Same write gates as fs_apply_patch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
createNo
projectNodemo
lease_idYes
content_base64Yes
expected_sha256No

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Beyond the destructiveHint annotation, the description discloses atomic temp+fsync+replace behavior, a 2MB decoded-size cap, Base64 format tolerance (line breaks, URL-safe alphabet, optional padding), and conflict behavior. This substantially enriches the agent's understanding of side effects and failure modes.

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?

Every sentence adds a necessary constraint or clarification. The description is dense but not verbose, front-loads the core purpose, and uses an ordered progression from input format to limits to overwrite semantics to atomicity.

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

Completeness5/5

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

This is a complex mutation tool with an output schema, and the description covers format, size limits, concurrency checks, atomic writes, and related tool behavior. It gives sufficient context for safe invocation without needing to inspect the schema.

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

Parameters5/5

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

With 0% schema description coverage, the description compensates richly: content_base64 is fully specified, expected_sha256 rules are explicit, create semantics are stated, lease_id is highlighted, and path is scoped to project root. This gives the agent far more than the bare property names.

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 a specific verb and resource: 'Write a binary file under the project root from plain Base64', clearly differentiating binary writes from the sibling fs_write_file. It also states scope constraints (project root) and input format (Base64, not data URL).

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?

Provides clear preconditions and semantics: lease_id is required, create=true for new files, expected_sha256 mandatory for existing files, and CONFLICT on mismatch. It references fs_apply_patch for write gates, but does not explicitly contrast with fs_write_file or state when to prefer text-file writing.

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/davidlosasgonzalez/codeagent-mcp'

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