Your First Simple Tool
Build a calculator tool, define it with JSON Schema in strict mode (strict: true), pass it to Claude, find every tool_use block in the response, and send the result back as a tool_result.
The Problem: Long Arithmetic Without a Tool
A language model produces its answer token by token, so an exact result for long multiplication is not guaranteed without a tool. The classic example from Anthropic's course was recorded on Claude 3 Haiku (that model was retired from the API on April 20, 2026):
Prompt: Multiply 1984135 by 9343116. Only respond with the result
Model answer: 18593367726060
Correct: 18538003464660
Off by about 55 billion
Current models may give a different answer. For calculations where every digit matters (money, taxes, units of measure), it is safer to hand the work to code.
The rest of this lesson opens after a free sign-up
Sign up with email or Google: the first two lessons of every course stay open for good, and the whole catalog is open for 7 days. No card needed.


