Function calling — also called tool calling — is how a language model invokes external tools and APIs. Instead of just answering with text, the model returns structured JSON that specifies which function to run and with what arguments. It is the small but decisive mechanism that lets an AI do something in the world — not just talk about it.
How function calling works
The point is often misunderstood: the model does not execute the code itself. It expresses the intent. The flow goes like this: you give the model a set of tool definitions (name, description and which arguments each tool takes). When the model decides it needs a tool — say, to look up a price or fetch fresh data — it does not answer with text, but with JSON saying "call the function get_price with the argument product: X." Your client application runs the actual call, fetches the result, and hands it back to the model, which then writes the final answer. The model decides what to do; your code does it.
The relationship with MCP
Function calling and the Model Context Protocol (MCP) are often confused, but they solve different parts of the same job. Function calling is phase 1: how the model expresses that it wants to do something. MCP is the infrastructure that makes those requests portable, discoverable and executable across systems. MCP is an open client-server standard built on JSON-RPC 2.0, with three core primitives: Tools (executable actions), Resources (contextual data) and Prompts (reusable templates). In short: MCP does not replace function calling — function calling is how the model requests an action, MCP is the plumbing that makes the same tool work everywhere.
Why it matters: agents
Function calling is the core mechanism behind AI agents. An agent is in practice a loop of tool calls: the model calls a tool, reads the result, evaluates and decides the next step — until the task is done. Without tool calls a model can only produce text; with it, it can search, fetch data, send requests and complete actions. In 2026 MCP has reached near-universal adoption — Anthropic, OpenAI, Google and Microsoft all support it — and hundreds of MCP servers are available in public registries. This is what makes agentic AI practical at scale.
How CitationLab uses this
CitationLab publishes its own MCP servers for both Manager and Monitor. They expose your visibility, citation and audit data as callable tools — so an AI agent can fetch how your brand is cited, run an AEO audit or look up Share of Voice directly via function calling, without a human clicking around a dashboard. Your data becomes action-ready for AI, not just visible to humans.
How others can use it
If you are building with AI, the lesson is that value lives in the tools you give the model, not just in the prompt. Define clear tools with precise descriptions and arguments, and consider exposing them via MCP so they work across models and clients. And want to make your business data available to AI agents the same way? See how AI visibility and agent-ready data connect, or look up more terms in the glossary.
Frequently asked questions
What is function calling?
What is the difference between function calling and MCP?
How does function calling relate to AI agents?
What does function calling have to do with AI visibility?
Definitions used in this article
- Function calling
- Function calling is the technique by which a language model invokes external tools and APIs by returning structured JSON that specifies which function to run and with what arguments. The model expresses the intent; the client application executes the call.
- Model Context Protocol (MCP)
- The Model Context Protocol (MCP) is an open client-server standard, built on JSON-RPC 2.0, that defines how tools are discovered, invoked and managed across applications and model providers. It makes tool calls portable between systems.
- AI agent
- An AI agent is software driven by a language model that plans and executes multiple steps itself toward a goal, by calling tools, reading the results and deciding the next step. Function calling is the underlying mechanism that makes this possible.
