Open Agent School · Public worked example

Tool Calling: meaning and example

Welcome! Take one idea with you today.

Tool calling lets a model return a structured request to run a function you defined, such as "look up booking 42". The model does not run anything. Your application receives the proposed call, checks the arguments against the tool's schema, confirms the signed-in user is allowed to do it, executes it, and sends the result back to the model.

Picture it: An invented climbing gym lets members chat with an agent that can view, book, and cancel lesson slots. In one synthetic session the model proposes eight calls: one has a malformed date, and two try to cancel slots belonging to other members. Decide where each bad call should be stopped.

What is easy to mix up?

A tool call is a proposal, not permission or execution. Validate arguments, authorize on the server with the real session identity, and confirm high-impact actions with the user.

Teaching example by Open Agent School. Source: OpenAI API docs - Function calling (application executes tool calls).