Cook the spaghetti in salted water until al dente.
In addition, cut the tomatoes into cubes. Heat oil in a large pan. Crush the garlic cloves by hand and add them to the pan with the tomatoes when the oil is hot. Fry the tomatoes, remove the pan from the heat and remove the garlic.
In the meantime, grate the cheese fresh.
Whisk the egg yolk, half of the cheese (50 g Parmesan and 50 g Pecorino) and plenty of black pepper in a tall container with a fork.
Drain the spaghetti, return to the hot saucepan and mix with the fried tomatoes. Then pour the egg mixture over it, fold in and serve immediately. Serve with the rest of the cheese.