Definition
Function calling, also called tool calling or tool use, is the ability of a language model to decide that it needs an external function, then return a structured request (a function name plus arguments in JSON) that the surrounding application executes. The result goes back to the model, which uses it to continue its answer. The model never runs the code itself; it only asks.
OpenAI added function calling to its API in June 2023, and every major model provider now supports it. A typical exchange has four steps. The developer describes the available tools, each with a name, a plain-language description and a JSON Schema for its parameters. The model reads the user's request and, if a tool would help, emits a call such as get_order_status with {"order_id": "A1042"}. The application runs the function and sends back the output. The model then answers, or calls another tool. OpenAI's function calling guide describes both JSON-schema function tools and free-form 'custom tools', plus tool search, which loads rarely used tool definitions only when needed.
The feature has grown well beyond single lookups. As of October 2026, GPT-6 Astra supports asynchronous tool calls, so the model keeps working while a slow function runs, and both GPT-6 Astra and GPT-6.1 Sol require OpenAI's Responses API for tool calling. Gemini 4 Argon supports function calling alongside built-in Google Search grounding, URL context and computer use. xAI's Grok 4.7 offers function calling plus server-side web search, X search and code execution. These built-in tools are themselves function calls: when an assistant searches the web, the model is generating a search query as a tool argument.
The Model Context Protocol standardizes the other side of the exchange. An MCP server publishes its tools once (listed through tools/list, invoked through tools/call, with JSON Schema inputs), and any MCP-compatible client can use them. The current specification, dated July 28, 2026, made the protocol stateless and added routing headers for gateways; MCP is now governed as a Linux Foundation project. Function calling is the model capability, MCP is the plumbing that makes tools portable across models.
Function calling matters for GEO in two ways. First, it is the mechanism behind AI search. The text of a search tool call, the grounding query, decides which pages are retrieved and which can be cited, so understanding how models phrase those queries tells you which wording your content needs to match. Second, AI agents increasingly reach brands through tools rather than web pages: a booking API, a product catalog exposed over MCP, or a pricing endpoint. If an agent can query your inventory directly while a competitor's data sits only in HTML, the agent has a reason to prefer you. Our comparison of AP2, ACP and MCP covers the protocols agents use for commerce.
Security is the main design constraint. Tool descriptions and tool outputs both enter the model's context, which makes them a channel for prompt injection. The MCP specification requires hosts to get explicit user consent before invoking a tool and to treat tool annotations from untrusted servers as untrusted. Keep tools narrowly scoped, validate every argument server-side, and log calls.
Examples of Function Calling / Tool Use
- An airline's support assistant defines a `rebook_flight` tool with origin, destination and date parameters; when a customer asks to move a trip, the model fills in the arguments and the airline's backend makes the change.
- A retailer exposes its live product catalog and stock levels as an MCP server, so shopping agents can check availability directly instead of scraping product pages.
- A GEO analyst inspects the search tool calls ChatGPT makes for 'best espresso machine under 500 dollars' and finds the model searches for 'espresso machine reviews 2026', a phrase the brand's buying guide never uses.
- A finance team uses GPT-6 Astra's asynchronous tool calls so the model keeps drafting a report while a 90-second database query runs in the background.
