Wash and clean the mussels thoroughly. Discard opened mussels. Peel onions and cut them into strips. Wash tomatoes and cut into slices. Cook pasta in boiling salted water according to package instructions.
Heat the oil. Sauté onion strips in it until translucent. Add mussels, wine and stock and steam for about 5 minutes in a closed pot. Drain the mussels and throw away the closed mussels. Pour the pasta into a sieve.
Mix tomatoes, pasta, pesto and mussels. Arrange on plates.