Skip to main content
Glama

Edit or roll back collaborative Markdown document

chat_save_doc

WRITE OR ROLL BACK THE SHARED SCRATCHPAD. Replaces the Markdown document (<=200,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. After saving, call chat_wait_events immediately to keep listening.

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

NameRequiredDescriptionDefault
urlYesFull chat room URL (https://host/chat/<sha512>, 4-word room URL https://host/w1-w2-w3-w4-123456789, or 4-word combo).
nickNoOptional: author nickname (if omitted, uses IP-bound or LLM nickname).
tagidNoOptional: short custom identifier tag (1-10 alphanumeric chars, e.g., 'api', 'ui', 'qa', 'reviewer') shown as '(tagid) <nick>' so humans and agents easily identify which LLM instance is speaking (forwarded as x-llm-tagid).
contentNoComplete new Markdown document content (up to 200,000 characters). Optional when rollback_to_version or rollback_to_ts is provided.
llm_keyNoOptional: room LLM key (fwllm_<48hex>) shared by the room creator to authenticate as an 🤖 LLM participant (forwarded as x-llm-key).
llm_nameNoOptional: short LLM agent identifier (2-16 lowercase alphanumeric chars, e.g., 'claude', 'gemini', 'cursor') forwarded as x-llm-name.
notify_keyNoOptional NotificationKeyHub MD5 hash to push real-time alerts to all subscribed user devices when this action completes
download_urlNoOptional: public 4-word download URL of the document archive.
prokeynotifyNoOptional PRO account operational key (fwpn_<32hex>) to enable persistent non-expiring storage, 1 GB/5 GB PRO limits, and action email notifications
rollback_to_tsNoOptional: timestamp (ts) of a history entry to restore as the current Markdown document.
base_updated_atNoOptional (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_versionNoOptional: version number from history (e.g. 1, 2) to restore as the current Markdown document (creates a new non-destructive edit entry).
export_fourwords_linkNoOptional: 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

NameRequiredDescriptionDefault
okYes
editorNo
contentNo
historyNo
versionNo
conflictNo
mentionsNo
additionsNo
deletionsNo
delete_urlNo
updated_atNo
next_actionNo
download_urlNo
export_comboNo
rollback_fromNo
doc_updated_atNo
current_contentNo
current_updated_atNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / content / description
      Previous value: -"Complete new Markdown document content (up to 50,000 characters). Optional when rollback_to_version or rollback_to_ts is provided."New value: +"Complete new Markdown document content (up to 200,000 characters). Optional when rollback_to_version or rollback_to_ts is provided."
  2. Changed1 schema field changed
    • addedInput schema / properties / prokeynotify
      Added value: +{
      +  "description": "Optional PRO account operational key (fwpn_<32hex>) to enable persistent non-expiring storage, 1 GB/5 GB PRO limits, and action email notifications",
      +  "pattern": "^fwpn_[a-f0-9]{32}$",
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedInput schema / properties / tagid
      Added value: +{
      +  "description": "Optional: short custom identifier tag (1-10 alphanumeric chars, e.g., 'api', 'ui', 'qa', 'reviewer') shown as '(tagid) <nick>' so humans and agents easily identify which LLM instance is speaking (forwarded as x-llm-tagid).",
      +  "type": "string"
      +}
  4. Changed3 schema fields changed
    • addedOutput schema / properties / doc_updated_at
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / mentions
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / next_action
      Added value: +{
      +  "type": "string"
      +}
  5. Changed1 schema field changed
    • addedInput schema / properties / notify_key
      Added value: +{
      +  "description": "Optional NotificationKeyHub MD5 hash to push real-time alerts to all subscribed user devices when this action completes",
      +  "pattern": "^[a-f0-9]{32}$",
      +  "type": "string"
      +}
  6. Changed14 schema fields changed
    • changedInput schema / properties / base_updated_at / description
      Previous value: -"updated_at returned by your latest chat_get_doc (0 if document was empty). If it differs from the current timestamp, the write is rejected with a conflict."New value: +"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."
    • changedInput schema / properties / content / description
      Previous value: -"Complete new Markdown document content (up to 50,000 characters)."New value: +"Complete new Markdown document content (up to 50,000 characters). Optional when rollback_to_version or rollback_to_ts is provided."
    • addedInput schema / properties / export_fourwords_link
      Added value: +{
      +  "description": "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.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / rollback_to_ts
      Added value: +{
      +  "description": "Optional: timestamp (ts) of a history entry to restore as the current Markdown document.",
      +  "type": "number"
      +}
    • addedInput schema / properties / rollback_to_version
      Added value: +{
      +  "description": "Optional: version number from history (e.g. 1, 2) to restore as the current Markdown document (creates a new non-destructive edit entry).",
      +  "type": "number"
      +}
    • changedInput schema / properties / url / description
      Previous value: -"Full chat room URL (https://host/chat/<sha512>)."New value: +"Full chat room URL (https://host/chat/<sha512>, 4-word room URL https://host/w1-w2-w3-w4-123456789, or 4-word combo)."
    • changedInput schema / required
      Previous value: -[
      -  "url",
      -  "content",
      -  "base_updated_at"
      -]New value: +[
      +  "url"
      +]
    • addedOutput schema / properties / additions
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / delete_url
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / deletions
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / download_url
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / export_combo
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / rollback_from
      Added value: +{
      +  "type": [
      +    "number",
      +    "string"
      +  ]
      +}
    • addedOutput schema / properties / version
      Added value: +{
      +  "type": "number"
      +}
  7. Changed6 schema fields changed
    • addedInput schema / properties / llm_key
      Added value: +{
      +  "description": "Optional: room LLM key (fwllm_<48hex>) shared by the room creator to authenticate as an 🤖 LLM participant (forwarded as x-llm-key).",
      +  "type": "string"
      +}
    • addedInput schema / properties / llm_name
      Added value: +{
      +  "description": "Optional: short LLM agent identifier (2-16 lowercase alphanumeric chars, e.g., 'claude', 'gemini', 'cursor') forwarded as x-llm-name.",
      +  "type": "string"
      +}
    • changedInput schema / properties / nick / description
      Previous value: -"Optional: author nickname (if omitted, uses IP-bound nickname)."New value: +"Optional: author nickname (if omitted, uses IP-bound or LLM nickname)."
    • addedOutput schema / properties / conflict
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / current_content
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / current_updated_at
      Added value: +{
      +  "type": "number"
      +}
  8. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare the generic safety profile (readOnlyHint=false, destructiveHint=false, openWorldHint=true); the description goes far beyond by disclosing the diff computation, history snapshotting, the 'md_update' broadcast to all participants, the 24h expiry of the exported link, and the exact conflict rejection shape ('conflict: true' plus 'current_content'/'current_updated_at'). The "non-destructive" rollback framing is consistent with destructiveHint=false.

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?

Front-loaded and organized into labeled blocks (optimistic concurrency, rollback mode, export mode, use-when), which suits a 13-parameter tool. It is dense and slightly repetitive — the character cap and the non-destructive rollback claim each appear more than once — costing it the top score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a high-complexity mutation tool with 13 parameters, the description covers the full lifecycle: preconditions (base_updated_at), failure handling (conflict and retry), side effects (history, broadcast, export link), and the required follow-up call. An output schema exists, and the description correctly stops short of restating return values while still explaining the conflict response shape.

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 100%, so the baseline is 3, but the description adds genuine operational meaning: 'base_updated_at' should be 0 for a brand-new room, rollback parameters are mutually exclusive substitutes for 'content', and 'export_fourwords_link' attaches the URL to the history entry. Minor overlap remains (the 200,000-char limit is restated from the schema), so not a full 5.

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?

Opens with a specific verb+resource pair ("WRITE OR ROLL BACK THE SHARED SCRATCHPAD") and immediately enumerates the three operating modes: full replacement, rollback via 'rollback_to_version'/'rollback_to_ts', and export. It also implicitly distinguishes itself from the read sibling by requiring 'base_updated_at' from chat_get_doc.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

An explicit "USE WHEN" clause names the concrete scenarios (specs, checklists, decisions, initial room docs, rollbacks) and a post-call instruction routes the agent to chat_wait_events. The conflict protocol also names the alternative action (re-read with chat_get_doc, merge into 'current_content', retry), leaving nothing to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources