Tool Calling
Tool Calling is a capability mechanism that enables large language models (LLMs) to interact with external tools or APIs. During response generation, the model can identify user intent and produce structured tool-invocation instructions; the runtime environment then executes the corresponding functions or services and returns results to the model. This enables tasks beyond pure text generation, such as information retrieval, code execution, and data manipulation, and is a foundational capability for building AI agents and complex automated workflows.
Core Facts
Function Calling (Tool Use) is a standardized mechanism for large models to invoke external tools, where developers pre-declare tool names, descriptions, and parameter schemas, and the model autonomously determines when to make a call.
The underlying mechanism of Tool Use is that developers pre-define the name, description, and parameter structure (Schema) of tools, and the model determines during inference when and which tool to call and outputs structured invocation instructions.
Since 2024, companies including OpenAI, Anthropic, and Google have successively launched agent frameworks.
Timeline (last 90 days)
Due to the stateless design of large model APIs, the entire tools array must be resent in every request, alongside the system prompt and conversation history.
When the number of tools is small, they belong to a single application, and their lifecycle is synchronized with the main program, directly using Spring AI's @Tool annotation-style Tool Calling is the simplest and most efficient solution.
If you are only defining a few tool functions in a single application for the model to call, Tool Calling is entirely sufficient, and introducing MCP instead adds complexity.
Tool Calling can work independently without introducing MCP, requiring no additional protocol.
Tool Calling is a capability of large language models: when generating a reply, the model outputs structured JSON indicating which function to call and what parameters to pass, but the model only outputs intent and does not execute code; the responsibility for execution lies on the application side.
When implementing Tool Calling, Spring AI already adopts encapsulation logic similar to MCP, so when developers migrate from Tool Calling to MCP they only need to adjust the communication layer, and the core business logic hardly needs rewriting.
Tool Calling allows an LLM to decide, during response generation, to invoke predefined external functions or APIs and incorporate the results into subsequent reasoning.
The agent determines which tool to call based on each tool's description, which is essentially a zero-shot semantic matching classification problem
Different frameworks define tool-calling formats differently (OpenAI format, Anthropic format, Ollama's own format), and models not trained for a specific format will produce malformed calls.
In LangChain's Agent and tool-calling pipeline, each tool call is typically assigned a unique Tool ID
17 more timeline events
All Facts (20)
Function Calling (Tool Use) is a standardized mechanism for large models to invoke external tools, where developers pre-declare tool names, descriptions, and parameter schemas, and the model autonomously determines when to make a call.
90%VerifiedThe underlying mechanism of Tool Use is that developers pre-define the name, description, and parameter structure (Schema) of tools, and the model determines during inference when and which tool to call and outputs structured invocation instructions.
90%VerifiedSince 2024, companies including OpenAI, Anthropic, and Google have successively launched agent frameworks.
90%VerifiedAgents use the Tool Calling mechanism to allow models to output calling intent in a structured JSON format, with external programs executing the actual operations and feeding results back to the model.
80%VerifiedAI SDK is a toolkit that helps developers build AI applications by abstracting common logic for interacting with large language models, such as streaming responses, message state management, and tool invocation.
75%VerifiedThe basic principle of tool calling is that the model identifies scenarios requiring external capabilities, outputs a structured function call request (usually in JSON format), and after the external system executes it, the result is returned to the model to continue reasoning.
75%VerifiedAfter the client receives the tool execution result, it needs to construct a message with the role set to tool, carrying the corresponding tool_call_id and execution result to send back to the model.
75%VerifiedThe Deep Research feature decomposes a single user query into multi-step autonomous research tasks, invokes tools such as web search and document analysis, and uses large language model reasoning to synthesize and output a structured report.
75%VerifiedTools are essentially function wrappers for external capabilities, paired with JSON Schema descriptions that enable the model to understand a tool's functionality and parameter format.
75%VerifiedLangChain is an open-source framework whose core capability is combining large language models with external computing resources and data sources.
75%VerifiedFunction Call does not actually execute code; the model only outputs a structured JSON string, and the actual execution is performed by the host program.
75%VerifiedThe naming, description, and parameter documentation of a tool are the key context for an Agent to decide when to call it, and can be understood as a form of prompt engineering.
70%VerifiedOpenAI's function calling/tool use mechanism is a hard constraint; the model inference engine directly constrains the valid set of output tokens during the decoding phase, thereby guaranteeing format compliance at the protocol level.
70%VerifiedThe tool-calling (Function Calling / Tool Use) capability enables LLMs to output structured intent instructions, which are captured by an external execution layer to actually operate on systems.
65%VerifiedThe implementation path for the vast majority of AI applications is to call existing large model API interfaces and customize using techniques such as prompt engineering and RAG, rather than training models from scratch.
65%Verified工具调用(Function Calling/Tool Use)是Agent系统的核心能力,允许模型动态调用搜索引擎、代码解释器、数据库查询、API接口等外部资源
65%VerifiedThe perception→reasoning→invocation→feedback loop of function calling is the engineering implementation of the ReAct (Reasoning + Acting) framework.
65%UnverifiedTool Calling存在三大核心痛点:描述繁复、调用不稳定、缺乏统一标准
85%UnverifiedThe tool-calling capability of intelligent agents allows language models to determine whether a tool needs to be called, generate call parameters conforming to the API specification, and continue reasoning based on the execution results.
70%UnverifiedVague tool authorization prompt descriptions can easily trigger completely different execution strategies in different models.
60%