How to Make AI Agents Use Tools Correctly: A Practical Implementation Guide