Personally, I would start with googling for "mach3 auto tool change macros"! That should give you some ideas.

BUT - every machine is different, so needs different macros. Do you have a carousel or tool rack? Fixed or moving rack? Auto draw bar - how is it controlled? What are the locking mechanisms on a carousel? And that's just for starters. What motion controller are you using? How many inputs/outputs? Does it have PLC capability?

This is non-trivial. Not necessarily difficult if you understand all the bits - mechanical, electronics, software - but a whole different ball game compared to the tool height setting macro that was the original topic.

Good luck...