A surgical device comprises an ex vivo magnet and an in vivo sled magnetically attracted to the ex vivo magnet. The sled can be positioned and anchored within a patient by moving the ex vivo magnet. The sled defines a longitudinal axis. An arm extends from the sled. The arm being moveable relative the sled between a retracted position and an extended position. The arm comprises an end effector. A locking mechanism operatively connected to the arm to lock the arm in the retracted and extended positions. The mechanism may include a rack that both rotates about a pinion and translates tangentially about the pinion.