Provable Benefits of In-Tool Learning for Large Language Models