What Is Function Calling (Tool Calling)?
Also known as: tool calling, tool use, LLM tool use
Definition
Function calling, also called tool calling, is a capability where an LLM outputs a structured request to run a named function with specific arguments, such as get_order_status(order_id). Your software executes it and returns the result to the model.
Function Calling (Tool Calling) Explained
A language model alone can only produce text. Function calling gives it hands: you describe a set of tools, each with a name, a purpose and a JSON schema for its parameters, and the model decides when a tool is needed and emits a structured call. Your application validates the arguments, runs the real code, and feeds the output back so the model can compose the final answer.
In an ERP setting the tools are thin wrappers over existing interfaces: a SyteLine IDO load collection, a NetSuite RESTlet, an Infor ION API call, or a stored procedure. A tool such as get_open_po_lines(vendor, due_before) wraps the query, enforces the user's ERP permissions, and returns clean JSON. The model never sees credentials or raw database access.
Function calling is the mechanism underneath AI agents. An agent is a loop in which the model repeatedly picks a tool, reads the result and decides the next step. The Model Context Protocol standardises how tools are described and exposed, so the same tool set works across different models and clients.
The design discipline matters more than the model. Narrow tools with strict parameter schemas, read-only by default, with write tools gated behind approval, are safer and more accurate than one broad tool that accepts free-form commands.
Why It Matters
- It is how an LLM reaches live ERP data and actions instead of guessing from training data.
- Strict schemas let you validate every call before it touches the ERP.
- Small, well-named tools are easier to audit, permission and test than free-form access.
- Open-weight models served with vLLM or Ollama support tool calling, so it works fully on-prem.
In Practice
A buyer asks, "What is late from Acme Castings?" The model calls get_open_po_lines with vendor set to ACME and due_before set to today. The wrapper queries the purchase order line table with the buyer's site filter, returns 7 lines as JSON, and the model summarises them with PO numbers and days late. If the buyer then asks to expedite, a separate write tool creates a draft action that waits for approval.
Frequently Asked Questions
Does function calling run code inside the model?
No. The model only emits a structured request. Your application decides whether to run it, executes the real code, and returns the result.
Is function calling the same as MCP?
They are related but different. Function calling is a model capability, while the Model Context Protocol is a standard way to describe and serve tools to any compatible model or client.
Do open-weight models support it?
Many do, including recent Llama, Qwen, Mistral and gpt-oss class models, and servers like vLLM expose a tool-calling API. Reliability varies by model, so test on your own tools.
How do I keep tool calls safe?
Validate arguments against the schema, run tools with the end user's ERP permissions, keep tools read-only by default, log every call, and require human approval for writes.
Related Terms
AI Agent
An AI agent is a system that wraps a language model with tools, memory, and a goal so it can plan a sequence of steps, call external systems, observe the results, and iterate until the objective is met or a limit is reached.
MCP (Model Context Protocol)
MCP (Model Context Protocol) is an open standard that defines how AI applications connect to external tools and data sources, so any compliant client can use any compliant server without custom integration code for each pair.
LLM (Large Language Model)
An LLM (Large Language Model) is a neural network with billions of parameters trained on huge volumes of text to predict the next token in a sequence, which gives it broad language understanding, reasoning, and generation ability.
REST API
A REST API is a web interface that exposes application data as addressable resources over HTTP, using standard verbs such as GET, POST, PUT, PATCH, and DELETE, stateless requests, and conventional status codes, typically exchanging JSON.
AI Guardrails
AI guardrails are the technical and policy controls placed around an AI system that constrain what it may receive as input, what it may produce as output, and what actions it is permitted to take, independent of what the model itself decides.
Working with Function Calling (Tool Calling) in a live environment? Our engineers do this every day - and our AI agents automate most of it.