You describe each tool with a name, description and JSON schema for its arguments; the model sees only these descriptions.
When it decides a tool is needed, it returns a structured request (function name plus arguments) instead of final text. Your code validates the arguments, checks permissions, runs the tool, and sends the result back as a tool message.
The model then continues, possibly calling more tools, until it writes the final answer.
The model never executes anything itself, so validation, authorization and error handling are the application's job.
Loading…