Tool calling, explained

Tool calling is also called function calling or tool use. It connects a model's language response to a defined way of reading information or requesting an action.

Tool calling lets an AI model return a structured request for an outside function, which the surrounding application can run and report back to the model.

The model proposes the call

The application gives the model descriptions of available tools. When a request needs one, the model can return the tool name and proposed inputs in a structured format.

The model does not run the function itself. The application receives the request, checks it, and decides whether to execute the tool.

The result returns as context

After the tool runs, the application sends its result back to the model. The model can then use that information to answer the original request or choose another allowed step.

This separation creates a control point. The application can reject invalid inputs, restrict permissions, or ask a person to approve an important action.

Tool calling terms

Tool definition
A description of an available function, including its purpose and expected inputs.
Tool call
Structured data that names a tool and supplies the inputs for one requested use.
Tool result
The information returned to the model after the application runs the tool.

Controls around a tool

Define one purpose

A narrow tool is easier to understand, limit, and test.

Check the inputs

The application should validate a proposed call before running it.

Protect important actions

Require approval where a tool can change money, access, or sensitive records.

Questions about tool calling

A tool call is the model's structured request. The application may use an API call or another method to perform the requested function.

No. It can only request tools the application has described and made available. The application still controls execution and access.

The result gives the model current information or confirms what happened. It can use that context to complete its response.

Connect each action to a clear rule

Caffeine apps run on the Internet Computer, a public network built for this.