Blitz one of the cans of tomatoes until smooth and set aside. Heat a glug of oil in a medium-sized saucepan over a medium heat. Add the onion and a generous pinch of salt and fry gently for 8-10 mins until softened and translucent. Tip the chilli and all the tomatoes into the pan, lower the heat, then simmer for 10 mins, uncovered. Fill one of the empty cans a quarter full with water and add this to the sauce. Stir through the capers, olives and anchovies. Season with salt, pepper and a couple of generous pinches of sugar. Cook on a gentle heat, uncovered, for a further 5 mins. Keep warm until needed.
Bring a large pan of water to the boil. Add the gnocchi and cook for 2 mins. Drain and toss with the tomato sauce, then tip into an ovenproof dish or shallow casserole. Top with the torn mozzarella and a good grating of black pepper then pop under a high grill for 3-4 mins or until the mozzarella is molten and gooey.