What Is Function Calling (Tool Use) in AI Models? A Plain-English Guide

Hand tools laid out, representing AI tool use and function calling

Function calling, also called tool use, lets an AI model request that your application run a specific function with specific arguments, so the model can act on live data or perform actions instead of only generating text from what it already knows. The model itself never runs the code — it decides when a tool is needed and what arguments to pass, your application executes the actual function, and the result is handed back so the model can use it in its final answer. That division of labor is what makes it possible to safely connect a model to a weather API, a database, or an internal system.

How Does the Function Calling Flow Actually Work?

The pattern is consistent across providers, even though the exact request format differs. According to Anthropic’s own documentation on tool use, the flow is three steps: you define a tool with a name, a description, and a schema for its expected inputs, and pass that definition to the model alongside the user’s message. If the model decides a tool fits the request, it responds with a structured tool-call block instead of (or alongside) plain text, naming the tool and the arguments it wants to use. Your application then executes that function with those arguments and sends the result back to the model, which uses it to write its final response.

Who Actually Runs the Tool — the Model or Your App?

Your application does, for anything custom. Anthropic’s documentation distinguishes between client tools — custom functions, along with things like a bash or text-editor tool — which your own application executes, and server tools, like web search or code execution, which run on the provider’s own infrastructure instead. This distinction matters for security: a custom tool you define only ever runs code you wrote and control, since the model can request it but cannot execute it directly.

How Do You Write a Good Tool Definition?

The tool’s name and description do more work than they look like they should — the model decides whether and how to call a tool almost entirely based on how clearly that description matches the user’s request. A vague description like “gets data” leads to inconsistent tool use; a specific one like “get_weather: returns current weather conditions for a given city and state, e.g. San Francisco, CA” gives the model enough to reliably decide when it applies and what format of input it expects. Being explicit about required versus optional parameters in the schema reduces malformed calls significantly.

What’s the Difference Between Tool Use and an AI Agent?

Tool use is the mechanism; an agent is what you build with it. A single tool call and response is just one exchange — an agent typically chains multiple tool calls together, using the result of one to decide whether and which tool to call next, continuing until it judges the task complete. Tool use without that surrounding loop is still useful (a single lookup to answer one question), but it’s the repeated, self-directed use of tools that turns a tool-using model into an agent.

Frequently Asked Questions

Does the AI model see the actual code behind a tool?

No. The model only ever sees the tool’s name, description, and input schema — the text you wrote to describe what the tool does and what arguments it takes. It never sees or executes your actual implementation code, which is exactly what keeps custom tools safe to connect to sensitive systems: the model can only request a call in the shape you defined, and your code decides what actually happens.

Can a model call multiple tools in a single turn?

Yes, most current models support requesting several tool calls at once when a request genuinely needs more than one piece of information, rather than being limited to one call per response. Your application is still responsible for executing each requested call and returning all the results before the model produces its next response.

Is function calling the same thing across OpenAI, Anthropic, and Google models?

The underlying concept is the same across providers — define a tool schema, let the model request a call, execute it, return the result — but the exact API request format, field names, and configuration options differ between providers. Code written for one provider’s tool-calling format generally needs adjustment, not just a swap of API keys, to run against another.

For the official documentation this article is based on, see Anthropic’s guide to tool use. To see how repeated tool calls turn into a full autonomous system, our guide on what an AI agent actually is covers that next layer, and our comparison of GPT-5, Gemini, and Claude looks at how these models differ in practice.

Featured image “Woodworking hand tools on timber planks” by A S M Jobaer, licensed under CC BY-SA 4.0, via Wikimedia Commons.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top