write_doc_commit
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
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes | The same document id the stage was begun for. | |
| reason | No | Optional. When omitted, the reason stored at begin is used. A different reason is refused. | |
| sha256 | Yes | Lowercase hex sha256 of the exact assembled text. | |
| source | No | Source tag. Must match the stage. | |
| exchange | No | The 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_id | Yes | ||
| part_count | Yes | How many parts were appended. Commit is refused if the stage holds a different number. | |
| session_id | No | Your 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). | |
| supersedes | No | Optional. When omitted, the value stored at begin is used. A different number is refused. | |
| updated_by | No | Alias of `source`. Prefer `source`. |