Robots Atlas>ROBOTS ATLAS
Tooling

Function Calling / Tool Calling

2023ActivePublished: 4 June 2026Updated: 14 August 2026Published
Key innovation
Lets large language models emit structured function invocations (name + schema-validated JSON arguments) that an application runtime executes deterministically and feeds back into the model — bridging natural-language reasoning with calls to external code, APIs and databases.
Category
Tooling
Abstraction level
Pattern
Operation level
ToolingInferenceOrchestration
Use cases
Calling external REST/GraphQL APIs from chatSQL / NoSQL database queriesNumerical and mathematical computation (calculator, Wolfram, code execution)Web search and document RAGAutonomous agents and task orchestrationForcing structured outputControlling IoT devices and robotsExecuting code in a sandbox

How it works

The application provides the model with a list of functions plus JSON schemas for their parameters. Through post-training (instruction tuning + RLHF on tool-use), the model decides whether to reply with text or emit a structured {name, arguments} call. The runtime parses the call, validates arguments against the schema, executes the function and injects the result back into context as a tool message. The model then reasons over the result or replies to the user. The loop can repeat (multi-step tool use) and — since November 2023 — the model can emit multiple calls at once (parallel tool calls).

Problem solved

A bare LLM is isolated from the world — no access to fresh data, databases, calculators, enterprise systems, or physical devices. Function Calling provides a reliable, structured bridge between the model's free-form reasoning and deterministic external code execution, eliminating brittle ad-hoc text parsing and format hallucinations.

Key mechanisms

A tool/function description with a parameter schema (usually JSON Schema)
The model selecting a tool and generating arguments in a structured format
Application-side execution and returning the result to the model in a follow-up turn
Parallel calls to multiple tools (parallel tool calls)
A multi-turn tool loop (reason -> call -> observe)

Strengths & limitations

Strengths
✓Bridges the LLM with real-world actions and up-to-date data
✓Structured, predictable output (a schema) that is easy to automate
✓The foundation of AI agents and integration with external systems
✓Support for parallel and multi-turn tool calls
✓Standardization (JSON Schema, MCP) improves portability
Limitations
✗The model can hallucinate tool names or arguments that violate the schema
✗Wrong tool choice or ordering in complex tasks
✗Security risk: executing actions with side effects (approvals/sandboxing needed)
✗Sensitivity to the quality of tool descriptions and prompt engineering
✗Growing token usage and latency with many tools and turns

Components

Tool definition (schema)Input contract

A tool's name, description and parameter schema (usually JSON Schema) passed to the model.

Tool selection & argument generationModel decision

The model decides which tool to call and generates its arguments in a structured format.

Tool executor (runtime)Execution and feedback

The application/agent layer that executes the call and returns the result to the model.

Official

Implementation

Implementation pitfalls
Hallucinated function names and argumentsHigh

The model may invent a nonexistent function or supply arguments that violate the schema. Mitigation: JSON schema validation before execution, strict / structured-output modes, error-feedback retries.

Fix:JSON schema validation, strict mode, error feedback on the next turn.
Tool-call loops and runaway costHigh

An agent can loop on the same function or invoke costly tools excessively. Mitigation: max-iteration limits, call deduplication, token and time budgets.

Fix:Iteration limits, call deduplication, token / time budgets.
Context bloat from tool resultsMedium

Function results (especially search and SQL) quickly fill the context window, raising cost and degrading quality. Mitigation: result summarisation, pagination, selective injection.

Fix:Summarisation, pagination, selective result injection.
Prompt injection via tool outputsCritical

Content returned from a function (web page, email, SQL row) may contain instructions trying to hijack the agent. Mitigation: isolating tool messages, marking untrusted content, tool-permission policies.

Fix:Tool-message isolation, sanitisation, permission policies.

Evolution

Original paper · 2023 · arXiv / Meta AI · Timo Schick
Toolformer: Language Models Can Teach Themselves to Use Tools
Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, Thomas Scialom
2022
ReAct: prompting interleaving reasoning and acting

Yao et al. showed an LLM can interleave "thought" and tool-invoking "action" steps in a single chain — the conceptual foundation for later function calling.

2023
Toolformer — a model that teaches itself to use tools

Meta AI publishes Toolformer (February 2023): the model self-supervises insertion of API calls in text and learns when to use them — the direct academic precursor to production function calling.

2023
OpenAI ships Function Calling in the API
Inflection point

On June 13, 2023 OpenAI releases function calling in gpt-3.5-turbo-0613 and gpt-4-0613. For the first time a widely available commercial LLM emits structured JSON function calls as a first-class response mode.

2023
Parallel tool calls and rename to "tools"

November 2023: OpenAI DevDay introduces the tools/tool_choice fields (replacing functions/function_call) and parallel tool calls — the model can issue multiple independent calls in one response.

2024
Anthropic Tool Use GA and Gemini Function Calling

Function calling becomes an industry standard — Anthropic Claude ships Tool Use GA (May 2024), Google Gemini exposes Function Calling, frameworks (LangChain, LlamaIndex) unify the interfaces.

2024
Model Context Protocol (MCP) — standardising tool exposure
Inflection point

Anthropic publishes MCP (November 2024) — an open protocol standardising how tools, data and resources are exposed to models via function calling, independent of the LLM provider.

Hyperparameters (configurable axes)

Tool choiceHigh

Controls calling: auto / force a specific tool / none.

autoThe model decides.
required/forcedForce a (specific) tool call.
noneDisallow calls in this turn.
Parallel tool callsMedium

Whether the model may return multiple tool calls at once.

true/falseEnable/disable parallel calls.

Computational complexity

Time complexity: O(t · c). Space complexity: O(n_tools + Σ wyników).

Execution paradigm

Primary mode
Conditional
Activation pattern
Input dependent
Routing mechanism

Guided by tool descriptions and conversation history, the model selects which function (if any) to call and what arguments to pass. Routing happens in the model's output-token space, with no external router.

Parallelism

Parallelism level
Partially parallel

A single tool-use decision is sequential, but since November 2023 (OpenAI parallel tool calls) the model can emit multiple independent calls in one turn that the runtime executes in parallel.

Scope
Inference

Hardware requirements

Primary

Function Calling is an application- and orchestration-level pattern — it runs anywhere a tool-use-capable language model runs, independent of hardware backend.