Skip to main content
Glama

aanet_write_file

Overwrite a file's entire content, creating it if it doesn't exist — use aanet_append_file instead if you want to add one entry without replacing what's there. Fires a file_write webhook event on success (see aanet_register_webhook).

Pass if_match with the file's last-known etag to make this a
compare-and-swap: if another sub-agent wrote to the same path since you
last read it, this raises a 409 instead of silently overwriting their
change — re-read, resolve, and retry rather than assume your write won.
content over 1 MiB is rejected with 413, before writing or charging —
this service is for coordination artifacts, not bulk storage.
Pass fence (from aanet_acquire_lock) to guard the write with a lock: a stale holder gets 409
STALE_FENCE. Returns {path, created, etag}.

Input Schema

NameRequiredDescriptionDefault
pathYesVirtual file path within the workspace.
fenceNoFencing token returned by aanet_acquire_lock/aanet_renew_lock. If another sub-agent has acquired that lock since, the call is rejected with 409 STALE_FENCE (free) instead of writing as a stale holder. Omit for an unguarded write.
stampNoIf true, appends a trailing `<!-- coordinated-via: aanet.space workspace_id=... -->` comment to the written content. Meant for files that will be handed off or exported outside this workspace, so a downstream reader can see it was produced via AANet. You are billed for the stamp's bytes like any other content.
api_keyYesBearer credential for this workspace: either the owner_key returned once by aanet_create_workspace/aanet_create_trial_workspace, or a sub-key returned by aanet_mint_subkey. Sent under the hood as `Authorization: Bearer <api_key>`. Owner-only tools reject a sub-key with a 403.
contentYesFull new content of the file — this replaces it entirely.
if_matchNoThe file's current etag (from aanet_read_file or a prior write's response), to detect a concurrent write from another sub-agent. Omit to overwrite unconditionally.
fence_lockNoName of the lock the fence belongs to; defaults to the file path itself. Needs fence.
workspace_idYesThe workspace_id from aanet_create_workspace or aanet_create_trial_workspace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / fence
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Fencing token returned by aanet_acquire_lock/aanet_renew_lock. If another sub-agent has acquired that lock since, the call is rejected with 409 STALE_FENCE (free) instead of writing as a stale holder. Omit for an unguarded write.",
      +  "title": "Fence"
      +}
    • addedInput schema / properties / fence_lock
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Name of the lock the fence belongs to; defaults to the file path itself. Needs fence.",
      +  "title": "Fence Lock"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / stamp
      Added value: +{
      +  "default": false,
      +  "description": "If true, appends a trailing `<!-- coordinated-via: aanet.space workspace_id=... -->` comment to the written content. Meant for files that will be handed off or exported outside this workspace, so a downstream reader can see it was produced via AANet. You are billed for the stamp's bytes like any other content.",
      +  "title": "Stamp",
      +  "type": "boolean"
      +}
  3. Changed5 schema fields changed
    • addedInput schema / properties / api_key / description
      Added value: +"Bearer credential for this workspace: either the owner_key returned once by aanet_create_workspace/aanet_create_trial_workspace, or a sub-key returned by aanet_mint_subkey. Sent under the hood as `Authorization: Bearer <api_key>`. Owner-only tools reject a sub-key with a 403."
    • addedInput schema / properties / content / description
      Added value: +"Full new content of the file — this replaces it entirely."
    • addedInput schema / properties / if_match / description
      Added value: +"The file's current etag (from aanet_read_file or a prior write's response), to detect a concurrent write from another sub-agent. Omit to overwrite unconditionally."
    • addedInput schema / properties / path / description
      Added value: +"Virtual file path within the workspace."
    • addedInput schema / properties / workspace_id / description
      Added value: +"The workspace_id from aanet_create_workspace or aanet_create_trial_workspace."
  4. First observed

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and succeeds: it discloses the webhook side effect, CAS conflict behavior, stale-fence rejection, size-limit rejection before writing or charging, and the return shape. These are exactly the behavioral traits an agent needs before invoking a mutating tool.

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?

The description is front-loaded with the primary action and the most important alternative (`aanet_append_file`), then layers conflict, size, and lock details. Every sentence adds operational value with no filler.

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?

For a mutating tool with no annotations and no output schema, the description is complete enough to call correctly: it explains side effects, error conditions, recovery behavior, and the return fields. Nothing essential is left for the agent to infer.

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, but the description adds meaningful semantics beyond the schema for `if_match`, `fence`, and the content size limit. It does not elaborate on every parameter such as `stamp` or `fence_lock`, but the schema already covers those adequately.

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 gives a specific verb and resource: overwrite a file's entire content and create it if absent. It also explicitly distinguishes this from the sibling `aanet_append_file`, so an agent can route between them without comparing schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states exactly when to use this tool versus `aanet_append_file`, and explains when to use `if_match` for compare-and-swap and `fence` for lock-guarded writes. It also tells the agent how to recover from a 409 rather than blindly retrying.

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