Trap-modulation spectroscopy of the Mott-insulator transition in optical lattices