GEAR: Augmenting Language Models with Generalizable and Efficient Tool Resolution