Molecular electronics is considered a promising approach for future nanoelectronic devices. In order that molecular junctions can be used as electrical switches or even memory devices, they need to be actuated between two distinct conductance states in a controlled and reproducible manner by external stimuli. Here we present a tripodal platform with a cantilever arm and a nitrile group at its end that is lifted from the surface. The formation of a coordinative bond between the nitrile nitrogen and the gold tip of a scanning tunnelling microscope can be controlled by both electrical and mechanical means, and leads to a hysteretic switching of the conductance of the junction by more than two orders of magnitude. This toggle switch can be actuated with high reproducibility so that the forces involved in the mechanical deformation of the molecular cantilever can be determined precisely with scanning tunnelling microscopy.