mjdeving
← concepts

Agents

Tool Calling

The model asking for a function to run, and your code deciding whether to run it.

Tool calling is the model asking your code to run a function. A bare model produces only text; each tool is one function you are willing to run on the model’s behalf, and the tool list is the complete set of things the agent can do. That makes the list two things: the extension mechanism and the safety boundary.

The mechanism is the same in every provider’s API. A tool is defined by three fields: a name, a description, and a schema for its arguments. When the model needs a function, it answers with a structured request instead of prose: this function, these arguments. Your code runs the function and returns the result as plain text; the model reads it and continues. Execution stays on your side of the boundary; the model only ever asks.