I have cleaned microswitches by immersing them in non-chlorinated brake cleaner and working the action, then blowing the cleaner out with compressed air. Do that several times. Do this with the switch removed from the airplane. Doing it while installed is mostly a waste of time.
But the only time that makes sense is when a new microswitch is not available. They aren't expensive, usually. Of course, some OEMs are famous for using some non-standard, rare and expensive stuff instead of common industrial components when they could have.
And watch to see how the mechanic is lubricating things near that switch. Some are convinced that if a little lube is good, a lot is much better, and the surplus gets into switches and other places where it causes trouble. Lube that is not right inside the moving stuff, against the bearing surfaces, is useless. Cessna flap actuators are the classic mess as mechanics hose oil or grease at them, and the limit switches get loaded with it and quit working. An up-limit switch that fails will not let the flaps retract, and in an overshoot that can get deadly if the conditions are right.