# Function Calling (Tool Use)

AI Glossary · Agents & Automation
Canonical URL: https://aisat.uk/glossary/function-calling
Author: Lucy Gilmore, Assistant General Counsel, Product, Privacy & AI at Sprinklr | Practical Privacy, Product & AI Governance & Defensible Risk Decisions (https://www.linkedin.com/in/lucy-gilmore/)
Breadcrumb: [Glossary](https://aisat.uk/glossary) > [Agents](https://aisat.uk/glossary?category=agents) > Function Calling (Tool Use)

## TL;DR

> **Function Calling (Tool Use)** is a capability that allows a language model to respond to a prompt by emitting a structured JSON object specifying an external function name and typed arguments, enabling the surrounding application to query APIs, search databases, or trigger actions.

## How Function Calling (Tool Use) works in practice

Despite the name, a language model never executes code or calls a network endpoint directly during inference. Instead, the developer passes an array of tool declarations alongside the prompt, each defined with a clear name, description, and a strict JSON Schema describing required and optional parameters. Models post-trained for tool use evaluate the conversation and decide whether they can answer directly or need external data/actions first.

When a tool is needed, constrained decoding guarantees the model outputs a valid JSON payload matching the declared schema (for example, `get_order_status({"order_id": "ORD-84920", "postcode": "SW1A 1AA"})`). The host application intercepts this stop reason, validates the arguments against application permissions, executes the real TypeScript or Python function against the database or REST API, and appends the returned result as a `tool` message in the conversation history. The model then reads that result and generates its next tool call or final natural-language answer.

For instance, a UK telecoms provider's broadband diagnostic assistant uses function calling to run live line-sync tests, check local exchange outages, and book Openreach engineer slots directly from a customer chat session.

## Why it matters and trade-offs

Function calling turns a conversational text generator into a deterministic integration layer between human intent and enterprise software. Combined with structured outputs and protocols like MCP, it allows models to fetch real-time pricing, run exact arithmetic in Python rather than guessing mentally, and update CRM records reliably.

Tool performance degrades rapidly when developers dump dozens of overlapping functions with vague parameter descriptions into a single prompt. Good tool engineering follows API design discipline: keep tool counts per step small (ideally under 15), use strict enums and regex patterns in JSON Schemas, return concise actionable error messages when a call fails so the model can self-correct, and never bind destructive tools without a permission check.

## Related AI concepts

- [Model Context Protocol (MCP)](https://aisat.uk/glossary/model-context-protocol): Model Context Protocol (MCP) is an open JSON-RPC standard introduced by Anthropic in November 2024 and donated to the Linux Foundation's Agentic AI Foundation in December 2025 that standardises how AI models and agents connect to external data and tools.
- [AI Agent](https://aisat.uk/glossary/ai-agent): An AI Agent is a software system powered by a large language model that perceives environment context, maintains state, formulates multi-step plans and executes actions across external tools, APIs and databases to complete a delegated goal.
- [Agentic Workflow](https://aisat.uk/glossary/agentic-workflow): An Agentic Workflow is a multi-step operational or engineering process in which a language model dynamically plans steps, calls external tools, critiques its own output and branches based on intermediate results within an orchestrated pipeline.
- [Guardrails](https://aisat.uk/glossary/guardrails): Guardrails are programmable validation layers placed on the input and output paths of an AI application to detect prompt injections, redact personally identifiable information, verify citations and block policy-violating completions in real time.
