Skip to content
CitationLab
Back to Glossary
Glossary

What is function calling (tool calling)? How AI acts on structured data

Function calling — or tool calling — is how a language model invokes external tools and APIs: it returns structured JSON specifying which function to run and with what arguments. It is the very mechanism behind AI agents, and it is closely tied to MCP. Here is what it is, and why it matters for how your data becomes available to AI.

KR
Krister Ross
Founder & CEO, CitationLab
Published 3 min read
Curious how AI talks about your brand?Run a free visibility check

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?
Function calling, or tool calling, is the technique by which a language model invokes an external tool or API by returning structured JSON that specifies which function to run and with what arguments. The model does not execute the code itself — it expresses the intent, and the client application performs the call.
What is the difference between function calling and MCP?
Function calling is how the model expresses that it wants to do something — it returns JSON with a function and arguments. MCP (Model Context Protocol) is the infrastructure that makes those requests portable, discoverable and executable across systems. MCP does not replace function calling; they are two phases of the same interaction.
How does function calling relate to AI agents?
Function calling is the core mechanism behind agents. It is what lets a model do something in the world — search, fetch data, send a request, complete a purchase — instead of only answering with text. An agent is in practice a loop of tool calls: the model calls a tool, reads the result, and decides the next step.
What does function calling have to do with AI visibility?
When AI agents fetch information and act via tool calls, what they can produce depends on whether your data is available as structured, callable tools. CitationLab, for example, publishes MCP servers that expose visibility and audit data as tools a model can call directly.
Key terms

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.
Share:

Hold deg oppdatert

Få fagartikler, produktnyheter og analyser rett i innboksen.