Skip to main content
Glama

write_file

Creates or updates markdown vault notes after validating frontmatter against the schema; refuses invalid writes and uses expected ETags for conditional, conflict-safe writes.

Instructions

WRITE — validates the frontmatter against the vault schema and refuses the write if it does not hold. The body is free: a new note, or one that already follows its kind's template (see template), that differs from the template is written, and the answer carries a warning naming what it lacks. Stamps updated with today and fills date when missing. Pass expected_etag from read_file to make the write conditional, or "*" to create a note that must not exist yet. .vault/styles/<kind>.md writes a kind's style as it is, without those checks; one whose first line <!-- style-version: N --> is older than the stored one is refused, and the user's .vault/styles/<kind>.override.md is never written.

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

Input Schema

NameRequiredDescriptionDefault
pathYes
vaultNo
contentYes
expected_etagNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.15.2
    • addedInput schema / properties / vault
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Vault"
      +}
  2. First observedv0.2.1

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations at all, the description carries the full behavioral burden and does substantial work: it discloses validation-before-write, refusal conditions (bad frontmatter, stale style-version), automatic field stamping, a warning returned when content diverges from the kind template, opt-in optimistic concurrency, and the guarantee that `.override.md` is never written. Gaps remain around permissions/auth and what a rejected write returns, but the mutation semantics are far clearer than typical.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the verb and the core promise, and most sentences add real information. However, the sentence about the body/template is a convoluted run-on ('a new note, or one that already follows its kind's template (see `template`), that differs from the template is written, and the answer carries a warning...') that takes rereading, and the style-version clause is similarly tangled.

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?

An output schema exists, so return values need not be spelled out, and the description still flags the warning payload. For a probably-destructive write tool with 0% schema coverage it covers concurrency, validation, and refusals well; the omission of the `vault` parameter and baseline overwrite behavior are the remaining holes.

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 description coverage is 0%, so the description must compensate, and it does well for `expected_etag` (exact concurrency semantics including the "*" sentinel) and partially for `path` (special-cased for `.vault/styles/<kind>.md`) and `content` ('the body is free'). The `vault` parameter is never mentioned at all, and `path` formats beyond the style case are unexplained.

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?

States a specific verb and resource (write a note/file into a vault) and layers in the distinguishing behaviors: frontmatter schema validation, `updated`/`date` stamping, and the special `.vault/styles/<kind>.md` path. It never explicitly contrasts itself with the sibling `append_file`, so an agent must infer that distinction, but within the description the operation is unambiguous.

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?

Gives concrete conditional guidance for `expected_etag` (pull it from read_file, or use "*" to require a non-existent note) and flags the style-file path as a separate mode with its own rules. It does not say when to prefer this over `append_file` or `delete_file`, nor what happens on plain overwrite, leaving a key selection decision implied.

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