The function is now a part of the CartInterface and implemented in the Cart::isShippable() method. You can use the CartManager service to retrieve the Cart object and call the method:
So the context is mandatory and it is actually important because it sets the data you want to fetch when the rule is triggered.
I just needed to set the context to the good entity as follow.
"entity" = @ContextDefinition("entity:uc_order",
The working annotation is the following.
* Definition of the action performed.
* id = "...
As for D8 latest version, it looks like uc_cart_get_contents is not working anymore. So here is how I managed to do it :
/** @var \Drupal\uc_cart\CartManager $cartManager */
$cartManager = \Drupal::service('uc_cart.manager');
$items = $cartManager->get()->getContents();
$variables['nbr_cart_items'] = count($items);