destroy_deployment
Remove a Velociraptor deployment permanently to clean up resources. This irreversible action deletes all associated data and requires confirmation.
Instructions
Destroy a Velociraptor deployment and clean up resources.
WARNING: This action is irreversible. All data will be lost.
Args: deployment_id: The deployment identifier to destroy confirm: Must be True to confirm destruction
Returns: Destruction status and cleanup details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deployment_id | Yes | ||
| confirm | No |
Implementation Reference
- The destroy_deployment tool handler in src/megaraptor_mcp/tools/deployment.py which performs the cleanup of deployments.
async def destroy_deployment( deployment_id: str, confirm: bool = False, ) -> list[TextContent]: """Destroy a Velociraptor deployment and clean up resources. WARNING: This action is irreversible. All data will be lost. Args: deployment_id: The deployment identifier to destroy confirm: Must be True to confirm destruction Returns: Destruction status and cleanup details. """ if not confirm: return [TextContent( type="text", text=json.dumps({ "error": "Destruction not confirmed", "message": "Set confirm=True to destroy the deployment", "warning": "This action is irreversible. All data will be lost.", }, indent=2) )] try: # Validate deployment_id deployment_id = validate_deployment_id(deployment_id) from ..deployment.deployers import DockerDeployer, BinaryDeployer from ..deployment.security import CertificateManager, CredentialStore # Try Docker first deployer = DockerDeployer() info = await deployer.get_status(deployment_id) if info: result = await deployer.destroy(deployment_id, force=True) # Clean up certificates and credentials cert_manager = CertificateManager() cert_manager.delete_bundle(deployment_id) cred_store = CredentialStore() cred_store.clear_deployment(deployment_id) return [TextContent( type="text", text=json.dumps(result.to_dict(), indent=2) )] # Try binary deployer deployer = BinaryDeployer() result = await deployer.destroy(deployment_id, force=True) return [TextContent( type="text", text=json.dumps(result.to_dict(), indent=2) )] except ValueError as e: # Validation errors return [TextContent( type="text", text=json.dumps({ "error": str(e), "hint": "Provide a valid deployment ID starting with 'vr-'" }, indent=2) )] except ImportError as e: return [TextContent( type="text", text=json.dumps({ "error": f"Missing dependency: {str(e)}", "hint": "Install required packages with: pip install megaraptor-mcp[deployment]" }, indent=2) )] except Exception: # Generic errors - don't expose internals return [TextContent( type="text", text=json.dumps({ "error": "Failed to destroy deployment", "hint": "Check deployment ID and ensure deployment exists" }, indent=2) )]