checkpoint_restore
Restore a virtual filesystem workspace to a saved checkpoint to recover previous states or undo changes.
Instructions
Restore workspace to a checkpoint.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |
Implementation Reference
- The handler function in CheckpointTools that executes the checkpoint restore logic by delegating to CheckpointManager and constructing the response.async def checkpoint_restore( self, request: CheckpointRestoreRequest ) -> CheckpointRestoreResponse: """ Restore workspace to a checkpoint. Args: request: CheckpointRestoreRequest with checkpoint_id Returns: CheckpointRestoreResponse with success status """ await self.checkpoint_manager.restore_checkpoint(request.checkpoint_id) return CheckpointRestoreResponse( success=True, checkpoint_id=request.checkpoint_id, restored_at=datetime.now(UTC), )
- src/chuk_mcp_vfs/server.py:161-164 (registration)Registration of the 'checkpoint_restore' tool via @server.tool decorator, which wraps and delegates to the CheckpointTools handler.async def checkpoint_restore(request: CheckpointRestoreRequest): """Restore workspace to a checkpoint.""" return await checkpoint_tools_instance.checkpoint_restore(request)
- src/chuk_mcp_vfs/models.py:304-316 (schema)Pydantic schema definitions for the input CheckpointRestoreRequest and output CheckpointRestoreResponse.class CheckpointRestoreRequest(BaseModel): """Request to restore checkpoint""" checkpoint_id: str class CheckpointRestoreResponse(BaseModel): """Response from checkpoint restore""" success: bool checkpoint_id: str restored_at: datetime
- Core helper method in CheckpointManager that performs the actual restore by calling the underlying snapshot manager.async def restore_checkpoint(self, checkpoint_id: str) -> bool: """ Restore workspace to a checkpoint. Args: checkpoint_id: Checkpoint ID to restore Returns: True if restore was successful Raises: ValueError: If checkpoint doesn't exist """ snapshot_mgr = self._get_snapshot_manager() success = await snapshot_mgr.restore_snapshot(checkpoint_id) if not success: raise ValueError(f"Checkpoint '{checkpoint_id}' does not exist") return success