Skip to main content
Glama

write_doc_commit

DestructiveIdempotent

Commit a staged document as one whole revision after verifying part count and sha256 hash. A repeat commit returns the original receipt without writing again.

Instructions

Assemble an open stage, check part_count and the sha256 of the exact assembled text (the concatenation of the parts in order, before this server redacts it), then write one revision through write_doc. A mismatch or a write_doc refusal leaves the current document unchanged and the stage open. A second commit of the same sha256 returns the first receipt and does not write another revision. A record is still one whole revision: it is superseded, never patched or appended.

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": {
      "stage_id": "<stage_id>",
      "doc_id": "<doc_id>",
      "sha256": "<sha256>",
      "part_count": "<part_count>"
    },
    "name": "write_doc_commit"
  }
}

Input Schema

NameRequiredDescriptionDefault
doc_idYesThe same document id the stage was begun for.
reasonNoOptional. When omitted, the reason stored at begin is used. A different reason is refused.
sha256YesLowercase hex sha256 of the exact assembled text.
sourceNoSource tag. Must match the stage.
exchangeNoThe exchange (turn) this write belongs to, counting from 1. A write for exchange n while exchange n-1 was never appended is refused by the session graph until n-1 is appended.
stage_idYes
part_countYesHow many parts were appended. Commit is refused if the stage holds a different number.
session_idNoYour transcript session id from emet_session_open. The session graph reads this session's state before the write and returns `session_graph.next` - the next step. A governed write with no session is refused (open one with emet_session_open and load_id).
supersedesNoOptional. When omitted, the value stored at begin is used. A different number is refused.
updated_byNoAlias of `source`. Prefer `source`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.2

TDQS

A4.5/5.0
Behavior5/5

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

Beyond destructiveHint=true and idempotentHint=true, the description discloses the concrete failure semantics (mismatch or refusal leaves the document unchanged and the stage open), the idempotency behavior (a second commit of the same sha256 returns the first receipt and writes nothing new), and the mutation model (supersede, never patch or append). These are exactly the behavioral traits the annotations only hint at.

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?

The action and its preconditions are front-loaded in the first sentence, and each later sentence supplies a distinct rule (failure atomicity, idempotency, supersede model). The prose is dense and jargon-heavy but no sentence is filler.

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?

For a 10-parameter governed write tool with no output schema, the description covers preconditions, atomicity, retry behavior, and the revision model, and mentions the receipt returned on a repeat commit. The only gap is not describing the receipt's contents, which is minor in the absence of an output schema.

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 90%, so the baseline is 3. The description adds real meaning for the two parameters that matter most, clarifying that sha256 covers the exact assembled text before server redaction (parts concatenated in order) and that part_count is validated against the stage's actual count.

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 names a specific verb and resource: assemble the open stage, verify part_count and sha256, then write exactly one revision through write_doc. It distinguishes itself from the sibling writes (write_doc_begin/append/abort and write_doc itself) by describing the stage-commit semantics precisely.

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?

The context of use is clear: an open stage must exist, part_count and sha256 must match, and a mismatch or refusal leaves both untouched. It does not, however, explicitly state when to prefer write_doc or write_doc_append/abort instead, so the alternatives are implied rather than spelled out.

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