What is Function Calling?
A model capability that allows LLMs to request calls to predefined functions with structured arguments.
Definition
Function calling (also called tool use) is a feature in LLMs that allows the model to output structured requests to call external functions, rather than only generating text. The model is given a list of available functions with their input schemas, and when appropriate, it responds with a structured call specifying which function to invoke and with what arguments. The calling application then executes the function and returns the result to the model.
Example
An LLM is given a `get_weather(city: string)` function. When asked 'What's the weather in London?', instead of guessing, it outputs `{function: 'get_weather', arguments: {city: 'London'}}`. The app calls the weather API and returns the result for the model to format.
Function Calling vs mcp: What's the difference?
A model capability that allows LLMs to request calls to predefined functions with structured arguments.
Function calling is model-specific (OpenAI, Anthropic, Google each implement it differently). MCP is a standardized protocol that works across AI clients.