Glossary

What is function calling?

Last reviewed 7 October 2026

Definition

Function calling is a feature of language model APIs that lets a model return a structured request to run a function you defined, with arguments that match its schema, instead of only replying in text. Your application runs the function and sends the result back. OpenAI and Anthropic both document it, and both also call it tool calling or tool use.

Also called: tool calling, tool use, function calls.

Why it matters

Why Function calling matters

Function calling is how a model gets from words to actions. Without it, connecting a model to a system meant asking for text and parsing it with fragile code. With it, the model fills in a typed request, such as a customer ID and a date range, and your code decides what to do with it. Almost every AI agent is built on this mechanism.

It also marks the safety boundary. The model does not execute anything. OpenAI’s guide has the application execute code using the tool call input, and Anthropic’s documentation says your application executes client tools. That gap between the model asking and the code acting is where you check permissions, validate arguments and ask a person.

Mechanism

How it works

You start by describing each function: a name, a description of when to use it, and a JSON schema for its parameters. You send these definitions with the request. The model reads the user’s message and the descriptions, and either answers directly or returns a tool call naming a function and its arguments. In Anthropic’s API the response arrives with a stop reason of tool_use and a tool_use block.

Your code runs the function, then sends the result back to the model in a second request. The model uses it to answer, or asks for another call. OpenAI describes this as five steps, from the first request with tools to the final response. Both vendors let you steer the choice: let the model decide, require a call or force a specific function, and OpenAI also lets you restrict calls to an allowed subset. Both support several tool calls in one turn, and both let you turn that off.

A schema is a request to the model unless you switch on a strict option. OpenAI’s strict mode makes function calls adhere to the schema instead of on a best-effort basis, with rules such as setting additionalProperties to false. Anthropic offers a strict option for custom tools. Validate arguments in your own code either way.

Worked example

Example: checking an order status

You define one function, get_order_status, described as “Look up the current status of a customer order by order number”, with one required string parameter, order_number. A customer writes: “Where is my order AB-2231?”

The model returns a call to get_order_status with order_number set to AB-2231. Your code checks that the caller owns the order, queries the order system and sends back that the parcel left the warehouse yesterday. The model replies to the customer in plain language. Had the customer left out the order number, a clear description and a strict schema make it more likely the model asks for it rather than inventing one.

Where Swfte stands

How Swfte relates to it

Built in the product

Swfte Connect handles tool calling on its OpenAI-compatible chat completions endpoint, so code that already sends OpenAI-style tool definitions can point at Connect and keep the same shape. Whether a given model supports tool calls, and how well, depends on the model and provider, so check before you route tool-heavy traffic to it.

In Swfte Studio you rarely write tool definitions by hand. Integrations give an agent its tools, and an approval step can hold a run for a named person before a consequential tool call. Studio agents can also call tools on external MCP servers.

Keep reading
  • Model Context Protocol (MCP)

    The Model Context Protocol (MCP) is an open protocol that gives AI applications a standard way to connect to external tools, data sources and prompts, so one integration can work with any compatible client.

  • AI agent

    An AI agent is a software program that uses an AI model to decide what to do next and then acts through tools to reach a goal it was given.

  • LLM agent

    An LLM agent is an agent whose decisions are made by a large language model, which reads a goal, reasons about it and chooses actions such as tool calls in a repeated loop.

  • MCP server

    An MCP server is a program that exposes capabilities to AI applications through the Model Context Protocol, so a model can call its tools, read its data and use its prompt templates.

Common questions

Does the model run the function itself?
No. The model only returns the function name and arguments. Your application runs the code, or for server-side tools the model provider runs it. This is why permission checks and argument validation belong in your code: the model’s request is a proposal until your system acts on it.
What is the difference between function calling and MCP?
Function calling is how a model asks for a function to run inside one API exchange. The Model Context Protocol is a standard for how tools and data sources describe themselves to AI applications, so one tool can be reused across many clients. An MCP client typically turns MCP tools into function definitions for the model.
Is function calling the same as JSON mode?
No. JSON mode or structured output makes the model reply in valid JSON that matches a format. Function calling goes further: the model picks which of several functions to call, fills in its arguments and expects a result back. Both rely on schemas, and both still need validation in your code.
Can a model call several functions at once?
Yes. OpenAI and Anthropic both support parallel tool calls in one turn, and both let you switch this off. Parallel calls help with independent lookups, such as fetching an order and a customer record together. Turn them off when one call depends on another’s result or when the order matters.
Evidence

Sources

Definitions on this page were read on the sources below on 7 October 2026. Where sources define the term differently, the page says so. The full glossary lists more terms.

  1. OpenAI developer guide to function calling (read 2026-10-07)
  2. Anthropic Claude documentation overview of tool use (read 2026-10-07)

Ready to build with Swfte?

One platform for the agents, models and workflows your team ships. Free to start, no card required.