The model asks, your code acts
The reply is a scripted assistant message in the real OpenAI-compatible shape. In Java the course's Json helper stands in for Jackson.
A model only produces text: it has no live data, it is unreliable at exact maths and it cannot act on the world. Tool calling lets the model ask for a function and lets your code run it, so the model supplies judgement and your code supplies facts and actions.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 6 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write parse_arguments(text) that returns the dict for a tool call's arguments string, or None when the text is not valid JSON or is not a JSON object.
Write make_tool_message(call, result) that returns the tool message dict for a tool call dict call (with an id) and a result string.
Explain it without notes
Why can't a model on its own tell you today's weather or multiply two five-digit numbers reliably?
Who actually runs a tool in function calling, and why does that matter for security?
What does the arguments field of a tool call contain, and what should your code do with it?
Expected output
model sent: {"role":"assistant","content":null,"tool_calls":[{"id":"call_1","type":"function","function":{"name":"multiply","arguments":"{\"a\":48271,\"b\":91}"}}]}
my code runs: multiply with a = 48271 and b = 91
sent back: {"role":"tool","tool_call_id":"call_1","content":"4392661"}