If your bun is large, use only one halve by cutting it in half to make a small sandwich.
Spread pesto on both sides of bun and lay the mozzarella on both halves.
Place whole basil leaves and tomato slices on one half of the bun and top with the other half of the bun (tomato and basil should be sandwiched between mozzarella).
Use a panini press to grill the sandwich for 2-3 minutes until cheese melts (see "Notes" below).
Notes:
If you don't have a panini press you can put the sandwich in a frying pan on medium heat and place a pot/pan onto the sandwich with something heavy in it to squish it down. Toast for 2-3 minutes then flip the sandwich using the pot/pan to squish it down again.