Save, restore or re-rule a workbook
write_workbookSaves, replaces, restores or re-rules a workbook directly, with no run. Save text you edited (document, or sheets, with the base_version you read); restore or undo to an earlier version (restore_version alone — no need to read first); or set its schema, the rules every edit must hold (schema alone, e.g. dates must be YYYY-MM-DD). Write in the workbook's form: read_workbook's file_type and edit_as say what its tabs hold — markdown for docx, a table per sheet for xlsx, one svg per slide for pptx, LaTeX/Typst for an editable pdf, glTF JSON for glb. Every save is compiled to that file type and against the schema; a failing one is refused with each error's tab and line. check_only compiles the same edit (text, tabs or schema) and says what a save would be told, saving nothing: check, fix, then save. A write made on an older version is merged onto the current one, and answers changed_by_others: the rows others changed since, so you catch up from those instead of reading again. WHEN SEVERAL AGENTS OR PEOPLE FILL ONE TABLE, divide it with claim rather than reading it to find empty rows: each claim hands you rows nobody else has; fill them and write only them with rows and tab on the version the claim answered, then claim again until none are left. Neither step needs a read of the table. A 3D (glb) workbook also comes back with a picture of the model, from the angles in views (or azimuth/elevation), so you can see what an edit did.
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": {
"workbook": "<workbook>"
},
"name": "write_workbook"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab | No | With `claim` or `rows`: the tab whose table it is, by id or name. | |
| note | No | One line on what changed. | |
| rows | No | Only some rows of one tab's table, as markdown rows (e.g. the rows a claim gave you, filled): each replaces the row with the same first cell, as the tab was at `base_version`, and others' rows are kept. Needs `tab`. | |
| agent | No | With `claim`: your name as the Claims tab shows it, one per agent (e.g. agent3). | |
| claim | No | When several agents or people fill one table at once: take this many of its rows (1-50) that nobody has claimed and that still have an empty cell. They are written to the workbook's Claims tab under `agent` and come back as a table, with the version to write on; no one else is given them. Fill them and write the tab as usual. Answers with no rows when every row is taken. Needs `tab` and `agent`. | |
| views | No | For a 3D (glb) workbook: the angles to picture the model from, up to 4. Default one three-quarter view (its own camera when it has one). | |
| schema | No | The whole new schema: a ```tables fence of JSON, and optionally a ```tla module. | |
| sheets | No | The tabs you change, add or remove; the others are kept. Tab ids come from read_workbook's `tabs`. | |
| azimuth | No | For a 3D workbook: one picture from this angle round the model, in degrees from the front (90 is the right side). Instead of `views`. | |
| document | No | The new text of a one-tab workbook. | |
| workbook | Yes | The workbook id. | |
| elevation | No | With `azimuth`: degrees above the horizon (0 level, 89 from above). | |
| from_file | No | An uploaded file (/attachments/<workbook>/<name>, as create_workbook's or upload's link names it, or a drive path) made the workbook's next version through its file type's import — its first, or a revised file (a remodelled .glb, a new export of the spreadsheet) over earlier versions, which stay restorable. To revise a workbook from a new file: upload it to /attachments/<this workbook>/<name>, then this. | |
| check_only | No | true to compile this edit and say what a save would be told, without saving. | |
| image_width | No | For a 3D workbook: the picture's width in pixels, 256 to 1024. Default 768. | |
| base_version | No | The version you read and changed. | |
| restore_version | No | An earlier version to make current again, as a new version. | |
| base_schema_version | No | With `schema`: the schema version you read; 0 where it had none. |