Heat about 2 tablespoons of oil in a pan and fry the gnocchi for about 5 minutes, then remove from the heat. Peel the onions and cut into fine rings. Wash tomatoes and cut in half. Mix the grated cheese with the cream, season with salt and cayenne pepper.
Grease a baking dish and add the gnocchi, mix with the cheese cream. Heat 2 tablespoons of oil in a pan and fry the onions until golden brown. Add tomatoes and fry briefly. Season with salt and pepper. Spread the tomatoes and onions on the gnocchi and bake in a preheated oven at 175 degrees for about 15 minutes.