Wash 8 tomatoes. Slice off the top of each tomato. Scoop out the seeds and insides with a spoon, leaving the walls intact. Season the insides with salt and pepper.
Cut the mozzarella into roughly 1 cm cubes. Mix the mozzarella cubes with the pesto. Spoon the mixture into the hollowed-out tomatoes and replace the tomato tops. Wrap each tomato tightly in aluminum foil.
Cook the wrapped tomatoes either on a grill heated to medium for 10 min or in an oven preheated to 180 °C (356 °F) for 10 min.