
Function calling is a pattern for connecting a model’s interpretation of a request to operations implemented by an application. Developers define functions that the application can perform, along with descriptions of their purpose and the inputs they require. When one of those functions appears relevant, the model can return a structured request to call it.
The application receives that request and decides what to do. It may validate the arguments, check authorization, run the function, and return the result to the model or user. The model generally does not execute the application’s function itself. It requests the operation, while the application controls dispatch and execution.
The term tool calling is also used for closely related patterns. Exact naming and message formats differ among platforms, but the underlying separation is important: a model can propose an operation, while software decides whether that operation is valid and permitted.
A model can interpret language, select from the function options made available to it, and provide arguments in a format the application can process. For instance, if a customer asks, “Where is my latest order?”, the model may recognize that an order lookup is relevant and provide the customer’s request as input to that function.
That does not establish the customer’s identity or prove that the customer is entitled to see a particular order. The application must verify those facts through its normal authorization mechanisms. Likewise, a syntactically valid request to issue a refund is not proof that a refund is allowed under company policy.
Think of function calling as a handoff between components:
Some applications expose several functions in one interaction, while others make only one function available at a time. The correct design depends on the task and on how much authority the application is willing to delegate to model-selected operations.
A customer asks whether a pair of headphones can be returned. The application makes two operations available: retrieve the customer’s order details and check the return policy for a purchase date. The model may request the order lookup first. The application verifies the customer’s identity and retrieves only the relevant order. It then uses the purchase date and product details to check eligibility.
The model can explain the result in plain language, but the eligibility decision should come from the retailer’s policy logic or another trusted source, not from the model’s guess. If the customer then asks to start a return, that should be treated as a separate operation. It changes the state of the order and may require a final confirmation.
Breaking the work into distinct operations makes it easier to apply different permissions and safeguards. Reading order information, evaluating a policy, and initiating a return do not necessarily carry the same risk.
A function should represent a coherent operation that the application can safely control. Avoid exposing a broad “do anything” function when smaller, purpose-specific operations would be easier to authorize and test. A narrow function also makes it clearer to the model what information to provide.
Useful design choices include:
A schema can help ensure that arguments have the expected shape, but it cannot establish that they are truthful, authorized, or appropriate for the request. Those checks belong in application logic and connected systems.
A correct-looking call can still be wrong. The model may select a plausible function but provide the wrong identifier or misinterpret the user’s intent. Validate values against trusted records and business rules before acting.
Retries can repeat side effects. A timeout does not always tell the application whether a connected system completed the operation. A retried payment, booking, or record change could happen twice unless the operation is designed to detect duplicates or safely handle repeat requests.
Tools expand the impact of prompt manipulation. Instructions embedded in user input or retrieved content may try to steer the model toward an unintended function. Descriptions and prompts can help guide behavior, but they are not security boundaries. Authorization and validation must remain outside the model.
Failures need an intentional path. A connected service may be unavailable, return incomplete data, or produce an error the model cannot interpret. The application should distinguish a failed operation from a successful result and avoid presenting an error as a confirmed fact.
Not every task needs a function call. If a model can answer safely using the information already provided, connecting an external system may add unnecessary latency and operational complexity. A function becomes more compelling when the application needs current or private data, a deterministic calculation, or an action that must be performed by a trusted system.
For each candidate operation, ask whether the model needs to choose it or whether ordinary application logic can determine when it should run. Letting the model select a function can be useful when user requests are varied or conversational. A fixed workflow may be easier to control when the steps are known in advance.
The best balance is not maximum tool access. It is enough capability to complete the task, with no broader authority than the workflow requires.
Before enabling function calling in a production workflow, verify that:
Function calling connects language-based requests to software operations. It can make an application more capable, but it also creates a boundary where model output may lead to real effects. The application must remain responsible for validating requests, enforcing permissions, and handling the operation’s result.
Expose narrow functions, separate information retrieval from consequential actions, and test failure paths as carefully as successful ones. That keeps the model useful as an interpreter without making it the authority over the systems it can reach.
