A Sn(IV) metallaporphyrin bearing a 4-pyridyl group on one meso position and a handle equipped also with a pyridyl unit functions in solution as a molecular gate in the presence of silver cation: the complexation-decomplexation of Ag(I) corresponds to the opening and closing motions of the gate.