Automation8 min read

Function Calling vs Tool Use: Same Loop, Different Names

OpenAI says function calling, Anthropic says tool use; both run the same loop. Here is how they compare on hosted tools, strict schemas, tool_choice and MCP.

By AI Agents DirectoryLast checked
Abstract illustration of a digital circuit pattern

“Function calling” and “tool use” are two names for one mechanism. OpenAI’s guide calls it function calling and notes it is “also known as tool calling”. Anthropic’s docs call it tool use and say it is “also called function calling”. Google’s Gemini docs say function calling. In every case you describe some functions with JSON Schema, the model decides when one is needed and replies with a structured request, and something runs that request and returns the result. So the useful question is not which approach is better, but where the three APIs actually differ. This post covers those differences. For the engineering side of wiring an agent to real APIs (auth, retries, pagination, idempotency), see our guide to connecting an AI agent to APIs.

The shared loop

All three vendors document the same round trip:

  1. Your request includes the user’s message plus a list of tool definitions: a name, a description and a JSON Schema for the arguments.
  2. The model either answers in text or returns a tool call naming one of your tools, with arguments filled in.
  3. Your code runs the function. Gemini’s docs stress this point: the model does not execute anything itself.
  4. You send the result back, tagged with the ID of the call it answers.
  5. The model writes a final reply, or asks for another tool call, and the loop repeats.

OpenAI lists this as five steps; Gemini’s guide groups it into four. Only the field names change between vendors.

Side-by-side

OpenAIAnthropic (Claude)Google Gemini
Term in the docsFunction calling (tool calling)Tool use (function calling)Function calling
Schema fieldparametersinput_schemaparameters
Model’s requestfunction_call item (Responses API)tool_use block, stop_reason: "tool_use"function_call step (Interactions API)
Your resultfunction_call_output with call_idtool_result with tool_use_idfunction_result with call_id
Provider-run toolsWeb search, code interpreter, MCP serversweb_search, web_fetch, code_execution, tool_search, MCP connectorGoogle Search, remote MCP
Schema enforcementstrict: truestrict: truevalidated mode
Tool choiceauto, required, one named function, allowed_tools, noneauto, any, tool, noneauto, any, none, validated, with allowed_tools
Turn off parallel callsparallel_tool_calls: falsedisable_parallel_tool_use: trueNot covered in the guide

Minimal request per vendor

These are trimmed from each vendor’s own function calling page. Each shows only the first request, the one that produces a tool call.

OpenAI (Responses API)

from openai import OpenAI
client = OpenAI()

tools = [{
    "type": "function",
    "name": "get_horoscope",
    "strict": True,
    "description": "Get today's horoscope for an astrological sign.",
    "parameters": {
        "type": "object",
        "properties": {"sign": {"type": "string", "description": "An astrological sign like Taurus or Aquarius"}},
        "required": ["sign"],
        "additionalProperties": False,
    },
}]

response = client.responses.create(
    model="gpt-6-astra",
    tools=tools,
    input=[{"role": "user", "content": "What is my horoscope? I am an Aquarius."}],
)

Anthropic (Messages API)

import anthropic
client = anthropic.Anthropic()

tools = [{
    "name": "get_weather",
    "description": "Get the current weather for a given location.",
    "input_schema": {
        "type": "object",
        "properties": {"location": {"type": "string", "description": "City and state, e.g. San Francisco, CA"}},
        "required": ["location"],
    },
}]

response = client.messages.create(
    model="claude-opus-5-5",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],
)

Google Gemini (Interactions API)

from google import genai

weather_function = {
    "type": "function",
    "name": "get_current_temperature",
    "description": "Gets the current temperature for a given location.",
    "parameters": {
        "type": "object",
        "properties": {"location": {"type": "string", "description": "The city name, e.g. San Francisco"}},
        "required": ["location"],
    },
}

client = genai.Client()
interaction = client.interactions.create(
    model="gemini-3.8-flash",
    input="What's the temperature in London?",
    tools=[weather_function],
)

The shapes are close enough that porting a tool definition between vendors is mostly renaming fields. The orchestration code around it is where most of the porting work lies.

Difference 1: who runs the tool

This is the distinction that matters most in practice. Anthropic sorts tools by where the code executes. Client tools, which include your own functions and Anthropic-defined schemas such as bash and text_editor, come back to your application to run. Server tools such as web_search, web_fetch, code_execution and tool_search run on Anthropic’s infrastructure, and the results arrive in the same response with no handler code on your side. Server tools can add usage charges on top of tokens; web search, for example, is billed per search.

OpenAI draws the same line with different words. A function is one kind of tool, defined by JSON Schema and executed by your code; OpenAI also offers built-in tools that let the model search the web, run code or use an MCP server. Gemini can mix built-in tools such as Google Search with your own functions in one request, and its docs say Gemini 3 models support that combination in the Interactions API.

If your agent only needs web search or a code sandbox, a hosted tool saves you writing and securing that code. If it needs your database or internal APIs, you are writing a client function on any vendor.

Difference 2: strict schemas

By default a model’s arguments are a best effort. All three vendors now offer a way to make them match your schema:

  • OpenAI: set strict: true on a function. OpenAI recommends always enabling it. It builds on structured outputs, so every object needs additionalProperties: false and every field must be listed as required; you mark optional fields by allowing null. If strict is left out, the Responses API tries to convert your schema to strict mode and falls back to non-strict if it cannot, while Chat Completions stays non-strict.
  • Anthropic: set strict: true on a tool. Claude’s sampling is then constrained by a grammar compiled from your schema, so the tool name is always valid and the input follows input_schema. Anthropic’s example: without it, a passengers integer could come back as "two" or "2".
  • Gemini: the validated tool choice mode makes the model keep to the function schema. In any mode the API compiles declarations into a state machine, and very large or deeply nested schemas can be rejected with a 400 INVALID_ARGUMENT error.

Strict mode only checks shape. It cannot tell whether a customer ID belongs to the caller, so validation in your own code still matters.

Difference 3: tool_choice

All three default to auto, where the model decides whether to call anything. The names for forcing a call differ:

  • OpenAI uses required (call at least one function), a named function, or none. Its allowed_tools option limits the model to a subset of tools without changing the tools list, which helps prompt caching.
  • Anthropic uses any (must call some tool), tool (must call this one) and none. One caveat from the docs: on Claude Opus 5.5, Claude Mythos 5.1, Claude Sonnet 5.5 and Claude Fable 5.1, any and tool return a 400 error. Anthropic suggests auto plus strict tool use for those models. Forcing a tool also skips the model’s thinking and any text before the call.
  • Gemini puts tool_choice inside generation_config, with auto, any, none and validated, and an allowed_tools list to narrow the set.

Difference 4: parallel and chained calls

A model can request several independent calls in one turn. OpenAI lets you stop this with parallel_tool_calls: false, which limits each turn to zero or one call. Anthropic does the same with disable_parallel_tool_use inside tool_choice. Gemini’s guide describes parallel function calling for independent calls and what it calls compositional function calling, where one call’s output feeds the next, such as getting a location first and then its weather.

If your functions have side effects that must happen in order, turning parallel calls off is the simple fix.

Where MCP fits

The Model Context Protocol is not a third style of function calling. It is an open standard for packaging tools on a server so any compatible client can use them. A client discovers tools with a tools/list request and runs one with tools/call; each tool carries a name, description and inputSchema, which maps directly onto the tool definitions above. The spec also says there should be a human able to deny tool invocations.

Each vendor can now reach a remote MCP server from its API:

  • OpenAI lists MCP servers among its built-in tools.
  • Anthropic’s MCP connector lets the Messages API call a remote server directly, so you need no MCP client of your own.
  • Gemini’s Interactions API takes an mcp_server tool with a url, but only Streamable HTTP servers work, not SSE, and server names should avoid the - character.

So you can write a tool once as an MCP server, for example a cloud admin server like AWS MCP Server, and use it with any of the three. For more infrastructure of this kind, browse the LLM infrastructure category, and see the OpenAI API listing for that platform.

Choosing

Pick the model for its quality on your task, not for whether it says “function” or “tool”. Then check the specifics this post covered: whether the hosted tools you want exist on that platform, whether forced tool choice works on the exact model you plan to use, and how its strict mode treats your schemas. The official guides are the place to confirm details, since they change often: OpenAI function calling, Anthropic tool use and Gemini function calling.

#Function calling#Tool use#Model Context Protocol#AI agents#LLM APIs
AI

Written by AI Agents Directory

Editorial team

Facts in this guide are checked against official documentation and repositories, which are linked in the article.