Dont book a shore excursion off the ship. You can then decide what to do when you get there because it is so so hot I would think twice about subjecting you and your children (especially the 3 yr old)to a long trip anywhere! We took a taxi to Pisa with our kids, it was cheaper and quicker and we went after all the coaches so it was less stressful as well. Look on Tripadvisor.com for advice on cost. Our taxi waited for us for 1.5 hrs (plenty of time)then drove us back. In Naples there are ferries every 30 mins to Capri in the port. Very cheap to do this yourself (again in your own time) and gentler than a hydrofoil for a young child. The following is a quote from tripadvisor forum on capri yesterday "The timetables are "guidelines", but you can pretty much catch a ferry every half hour or so either direction. The hydrofoils cost 14,50€ and the journey is roughly 15 minutes and the regular ferry is 9,80€ and takes 30-40 minutes. " they also tell us that there are 3 companies that run ferries all from the same dock and you should buy a single ticket each way as you dont know when you come to return to Naples which companies boat will leave first !! Finally make sure you drink lots of water !! Hope this helps.
I would suggest that from Livorno you go to Pisa as the Leaning Tower is well known to most youngsters and to see it for real is a great experience, there is also a certain amount of geometry and maths that can be explained to one anyway without making it tedious, plus the ice cream is terrific there. Naples is a little more difficult because it is a little dangerous there. I would suggest that a hydrofoil ride to Sorrento or Capri might be different and exciting enough for them. Whatever you do take or buy plenty of drink because in July it is going to be hot. .. regards ..Neil.