Boil the potatoes in plenty of water until, when you try to pierce them with a fork, it will go in without difficulty. Drain the potatoes, transfer them to a bowl and let them cool completely.
Peel the onions and cut them into thin slices.
In a nonstick skillet, heat 2–3 tablespoons of olive oil over medium heat. Add the onions and sauté until translucent.
Add the peeled tomatoes. Reduce heat to low, cover and cook for another 15 minutes.
After 15 minutes, add the capers, olives and tuna, a pinch of salt and the chili powder (optional).
In the meantime, peel the potatoes and mash them with a potato masher.
Place the potatoes in a bowl and add 3–4 tablespoons of the tomato and onion sauce, 100 g of pecorino, more salt to taste, a pinch of black pepper and the eggs. Knead with your hands to mix everything well.
Grease an approximately 30×23 cm baking dish with oil or butter. Wet your hands and put half the potato mixture, crushing it and leveling it well with your hands to cover the entire baking dish.
Add the filling and sprinkle with the remaining pecorino.
Cover with the rest of the potatoes, always wetting your hands.
Sprinkle everything with breadcrumbs.
Bake at 170 °C for about 45 minutes, placing the baking dish in the lower part of the oven, until lightly brown.