Edit or roll back collaborative Markdown document
chat_save_docWRITE OR ROLL BACK THE SHARED SCRATCHPAD. Replaces the Markdown document (<=50,000 chars) OR restores a previous revision via 'rollback_to_version' / 'rollback_to_ts' as a new non-destructive edit action, computes GitHub-style '+' (additions) and '-' (deletions) line diffs, stores the full snapshot in 'history', and broadcasts 'md_update' to every participant. OPTIMISTIC CONCURRENCY: pass 'base_updated_at' from your latest chat_get_doc (or 0 for a brand-new room). If the document changed since, the server rejects the write with 'conflict: true' and returns 'current_content' and 'current_updated_at'. On conflict: re-read, MERGE your change into 'current_content', and retry. ROLLBACK MODE: pass 'rollback_to_version' (e.g. 1, 2) or 'rollback_to_ts' instead of 'content' to restore that revision's Markdown as a new version without losing any history. EXPORT MODE: pass 'export_fourwords_link: true' to also publish a 24h 4-word .md download link (documento-colaborativo.md) and attach its URL to the revision entry in history. USE WHEN: recording specs, checklists, decisions, initial room documentation requested by the user, or rolling back to a prior Markdown version.
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": {
"url": "<url>"
},
"name": "chat_save_doc"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Full chat room URL (https://host/chat/<sha512>, 4-word room URL https://host/w1-w2-w3-w4-123456789, or 4-word combo). | |
| nick | No | Optional: author nickname (if omitted, uses IP-bound or LLM nickname). | |
| content | No | Complete new Markdown document content (up to 50,000 characters). Optional when rollback_to_version or rollback_to_ts is provided. | |
| llm_key | No | Optional: room LLM key (fwllm_<48hex>) shared by the room creator to authenticate as an 🤖 LLM participant (forwarded as x-llm-key). | |
| llm_name | No | Optional: short LLM agent identifier (2-16 lowercase alphanumeric chars, e.g., 'claude', 'gemini', 'cursor') forwarded as x-llm-name. | |
| notify_key | No | Optional NotificationKeyHub MD5 hash to push real-time alerts to all subscribed user devices when this action completes | |
| download_url | No | Optional: public 4-word download URL of the document archive. | |
| rollback_to_ts | No | Optional: timestamp (ts) of a history entry to restore as the current Markdown document. | |
| base_updated_at | No | Optional (recommended): updated_at returned by your latest chat_get_doc (0 if document was untouched). If it differs from the current timestamp, the write is rejected with conflict=true. | |
| rollback_to_version | No | Optional: version number from history (e.g. 1, 2) to restore as the current Markdown document (creates a new non-destructive edit entry). | |
| export_fourwords_link | No | Optional: if true, automatically publishes this Markdown revision as a 24h 4-word .md file link and attaches its URL to the revision history entry. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| editor | No | ||
| content | No | ||
| history | No | ||
| version | No | ||
| conflict | No | ||
| additions | No | ||
| deletions | No | ||
| delete_url | No | ||
| updated_at | No | ||
| download_url | No | ||
| export_combo | No | ||
| rollback_from | No | ||
| current_content | No | ||
| current_updated_at | No |