Write Document
write_documentReplace document text while preserving Scrivener formatting. Reports if formatting is fully preserved or takes a snapshot when non-round-trippable content would be dropped.
Instructions
Replace a document's text with new content, preserving the surrounding Scrivener formatting the edit did not touch (stylesheet, styles, images, footnotes) byte-for-byte. The result reports whether formatting was fully preserved; when an edit would drop non-round-trippable content it takes a Scrivener snapshot first (restorable in Scrivener) and says so. To change only the title or metadata use update_document; to add a new document use create_document. Requires an open project and a valid document id.
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": {
"documentId": "<documentId>",
"content": "<content>"
},
"name": "write_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Write even if the project appears open in Scrivener. Default false, which refuses the write to protect against your changes being overwritten by Scrivener on save. | |
| content | Yes | Document body as plain text. May be empty. | |
| documentId | Yes | Scrivener document UUID, as returned by get_structure (a binder item "id"). |