You send the model a list of tool definitions (name, description, JSON schema for parameters) along with the conversation; the model sees only that text, never your code.
If it decides a tool is needed, it returns a structured request: a tool name, JSON arguments, and a call ID, instead of final prose.
Your application parses the request, validates it, checks permissions, executes the function, and sends back a tool-result message tagged with the same call ID; the model then continues, possibly calling more tools.
The model never executes anything; whatever it can "do" is limited to what your code implements and allows.
Loading…