In short
Tool calling, also known as function calling, is when an AI model produces structured output (usually JSON) that asks your program to run a specific function, instead of just replying with text. The model does not run the function itself; it picks which tool to use, fills in the arguments in a format that matches a schema you defined, and your code executes it and feeds the result back. Tool calling is the core mechanism that turns a chatbot into an agent: it is how a model fetches live data, runs code, queries a database or sends an email.
How tool calling works
You give the model a list of tools, each described by a JSON schema: the tool name, what it does, and the parameters it accepts with their types. When the model decides a tool is needed, it returns a structured call with the chosen tool and arguments. Your runtime parses that, executes the real function, and returns the output to the model so it can continue, perhaps calling more tools, until it can answer.
- You define tools as JSON schemas: name, description, typed parameters.
- The model returns a structured call (tool name plus arguments), not free text.
- Your code runs the function and feeds the result back to the model.
Why it matters
Tool calling bridges probabilistic reasoning and deterministic execution. The model is good at deciding what to do; your code is good at reliably doing it. By forcing the model to output a structured call that matches a schema, you get dependable, machine-readable actions instead of hoping it formats a request correctly in prose. This is the foundation under AI agents and under standards like MCP, which expose tools over a shared protocol.
Tool calling and MCP
Tool calling is the local mechanism: tools defined for one model in one app. MCP (Model Context Protocol) standardises it across the ecosystem, so an MCP server can offer tools that any MCP-aware client can call without custom wiring. Put simply, tool calling is the verb, and MCP is one widely adopted way to make those tools reusable everywhere.
