manage_history
Create labeled checkpoints before large edits or restore a document to an earlier version by label or version, with path confirmation to prevent accidental overwrites.
Instructions
Label the project's current version as a checkpoint, or restore one document to an earlier version. create_label takes comment, 1 to 1000 characters, and labels the version current just before the call; create one before a large edit, so the version before it can be found again. It returns label { id, comment, version, createdAt } and verified (the label was read back). restore_file takes filePath, version or labelId, and confirmPath equal to filePath, else CONFIRMATION_MISMATCH and nothing is sent. filePath is the path the document had at that version; one the version lacks is NOT_FOUND, and a binary file INVALID_ARGUMENT with details.kind binary_file, before anything is sent. Overleaf deletes the live file and creates a new document with that version's text, tracked changes, and comments, so changes and comments made since are gone, comment threads get new ids, the document gets a new docId, and every revision of the old one stops working; a root document stays the root. It returns filePath, version, docId, previousDocId (null when nothing was at the path), the new document's revision, protocol, trackChangesActive, and contentMatches (its text equals what read_file_version reads). Nothing is retried: a lost or failed answer is read back, giving recoveredAfterTimeout: true when it applied, REMOTE_ERROR with details.outcome not_applied when Overleaf failed it and nothing changed, and otherwise OUTCOME_UNKNOWN: read the history or the tree before acting again.
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": {
"projectId": "<projectId>",
"action": "<action>"
},
"name": "manage_history"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| comment | No | create_label: what the checkpoint marks | |
| labelId | No | restore_file: the label whose version to restore | |
| version | No | restore_file: the version to restore; or pass labelId | |
| filePath | No | restore_file: the document, as named at that version | |
| projectId | Yes | Overleaf project ID | |
| confirmPath | No | restore_file: must equal filePath |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docId | No | ||
| label | No | ||
| action | Yes | ||
| version | No | ||
| filePath | No | ||
| protocol | No | ||
| revision | No | ||
| verified | No | ||
| previousDocId | No | ||
| contentMatches | No | ||
| trackChangesActive | No | ||
| recoveredAfterTimeout | No |