Skip to content
Article Issue #5178

Function Calling

What to know

Function Calling is a feature supported by major LLM APIs whereby the model, instead of producing a text response, emits a structured request to invoke one of a set of tools the developer has declared; Developers supply a list of tool schemas, each describing a function name, description, and parameter types in JSON Schema format; Function calling is the primary mechanism for giving LLMs the ability to interact with external systems: querying databases, calling APIs, reading files, or sending messages

Function Calling, WikiWalls Glossary illustration

« Back to Glossary Index

Function Calling is a feature supported by major LLM APIs whereby the model, instead of producing a text response, emits a structured request to invoke one of a set of tools the developer has declared. The model does not execute the function itself; it signals intent and the calling application handles execution, then feeds results back into the conversation.

How it works

Developers supply a list of tool schemas, each describing a function name, description, and parameter types in JSON Schema format. At inference time, the model decides whether to answer directly or to call a tool. If it opts to call a tool, it returns a tool-use message containing the function name and argument values; the application executes the function, then sends a tool-result message back so the model can continue.

Key facts

  • Parallel calls: Models like GPT-4o and Claude 3.5 support calling multiple tools in a single response turn.
  • Strict mode: Some APIs offer strict schema adherence, preventing hallucinated parameter names or types.
  • MCP: The Model Context Protocol standardizes function calling schemas and tool discovery across different models and applications.
  • Security: Tool inputs from models should be validated and sanitized before execution, as a compromised or jailbroken model could supply malicious arguments.

For builders

Function calling is the primary mechanism for giving LLMs the ability to interact with external systems: querying databases, calling APIs, reading files, or sending messages. It shifts the integration pattern from parsing free-text responses to handling structured JSON, which is dramatically more reliable. Builders should define tight schemas with clear descriptions, since the model uses the description to decide when and how to call each tool.

Sources

« Back to Definition Index
Administrator · 41 published guides · Joined 2016

Welcome to wikiwalls

The WikiWalls Journal · Free, weekly

One careful fix in your inbox each Wednesday.

No affiliate links inside the diagnosis. No sponsored "top 10". One careful fix per week — unsubscribe in one click.

No tracking pixels · No spam · Edited by a human.