Covering exposed contacts on a toggle switch
Use heat-shrink tubing.  Use a small size that will shrink to a snug fit on the wires and terminals, and a larger size to cover the body of the switch, and extend over the wires.

If the switch carries 120 or 240 VAC, I would prefer to add a box to contain the switch and wires, but the heat-shrink technique should be OK (not ideal) for low voltage.