sitebay_backup_restore
Restore WordPress sites to previous backup points, configure database and file restoration, and simulate changes before applying them.
Instructions
Restore a site to a previous point in time.
Args (PITRestoreCreate schema): fqdn: The site domain restore_point: ISO datetime string (or omit for latest) for_stage_site: Whether to restore the stage site restore_db: Restore database (default true) restore_wp_content: Restore wp-content (default true) delete_extra_files: Delete extra files from target (default false) dolt_restore_hash: Optional Dolt hash to restore DB is_dry_run: Simulate restore without applying changes
Returns: Restore operation confirmation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fqdn | Yes | ||
| restore_point | No | ||
| for_stage_site | No | ||
| restore_db | No | ||
| restore_wp_content | No | ||
| delete_extra_files | No | ||
| dolt_restore_hash | No | ||
| is_dry_run | No |
Implementation Reference
- src/sitebay_mcp/server.py:542-603 (handler)Primary handler function for the 'sitebay_backup_restore' tool. Decorated with @mcp.tool for automatic registration in the MCP server. Implements the core logic: logs the action, initializes the SiteBay client, constructs restore parameters from inputs, calls client.create_restore(), and returns success/error messages.@mcp.tool async def sitebay_backup_restore( ctx: Context, fqdn: str, restore_point: Optional[str] = None, for_stage_site: Optional[bool] = None, restore_db: Optional[bool] = None, restore_wp_content: Optional[bool] = None, delete_extra_files: Optional[bool] = None, dolt_restore_hash: Optional[str] = None, is_dry_run: Optional[bool] = None, ) -> str: """ Restore a site to a previous point in time. Args (PITRestoreCreate schema): fqdn: The site domain restore_point: ISO datetime string (or omit for latest) for_stage_site: Whether to restore the stage site restore_db: Restore database (default true) restore_wp_content: Restore wp-content (default true) delete_extra_files: Delete extra files from target (default false) dolt_restore_hash: Optional Dolt hash to restore DB is_dry_run: Simulate restore without applying changes Returns: Restore operation confirmation """ try: await ctx.info(f"Starting point-in-time restore for {fqdn}") client = await initialize_client() restore_data: dict[str, Any] = {} if restore_point is not None: restore_data["restore_point"] = restore_point if for_stage_site is not None: restore_data["for_stage_site"] = for_stage_site if restore_db is not None: restore_data["restore_db"] = restore_db if restore_wp_content is not None: restore_data["restore_wp_content"] = restore_wp_content if delete_extra_files is not None: restore_data["delete_extra_files"] = delete_extra_files if dolt_restore_hash is not None: restore_data["dolt_restore_hash"] = dolt_restore_hash if is_dry_run is not None: restore_data["is_dry_run"] = is_dry_run result = await client.create_restore(fqdn, restore_data) await ctx.info(f"Successfully initiated restore for {fqdn}") return ( "✅ **Point-in-Time Restore Initiated**\n\n" f"Restore operation for {fqdn} has been started." ) except SiteBayError as e: await ctx.error(f"Error starting restore: {str(e)}") return f"❌ Restore Error: {str(e)}" except Exception as e: await ctx.error(f"Unexpected restore error: {str(e)}") return f"❌ Unexpected error: {str(e)}"