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.
Try it here, free
Epicor Function Library Design Template
A design document for an Epicor function: signature, inputs, outputs, logic notes, security, test cases and sign off.
Keep exploring
Free tools
- Epicor Function Library Design TemplateA design document for an Epicor function: signature, inputs, outputs, logic notes, security, test cases and sign off.
- AI Agent Tool Permission WorksheetInventory each agent tool, score its blast radius and decide who approves it before an AI agent touches ERP data.
- JD Edwards C Business Function Skeleton GeneratorGenerate the .h and .c skeleton of a JD Edwards EnterpriseOne C business function that reads one table record by key, returns a value and sets an error correctly.
ERP fixes and how-tos
- Epicor Function Custom Code: C# Signature, Parameters and Calling ItWrite custom C# code in Epicor Functions: signature, request and response parameters, libraries, calling from BPM and Application Studio, with working examples.
- Epicor Function Examples: Update a Table, Call It, Schedule ItWorked Epicor Kinetic Function examples: updating a table, calling a function from a BPM, Application Studio or REST, and scheduling a recurring run.
- How to create and call an Epicor FunctionHow to create Epicor Functions in Function Studio: define inputs and outputs, write the C# widget, test, then call the function from a BPM directive.
Guides
- LLM Integration Patterns for Enterprise ERP SystemsIntegrate large language models with enterprise ERP systems using RAG, fine-tuning, function calling, and prompt engineering patterns for production deployment.
- Agentic Workflow Patterns for the Enterprise in 2026Agentic workflow patterns for 2026: planner-executor, tool loops, and structured outputs, with a framework for choosing the right pattern for your use case.
- Agentic RAG Patterns: When Retrieval Needs a Decision LoopAgentic RAG patterns: query rewriting, iterative retrieval, self-correction, and tool-calling agents that decide when and what to retrieve, not just once.
Integrations
- How to build an MCP server for SAP Business ByDesignBuild a Model Context Protocol server for SAP Business ByDesign: tools to expose, OData and SOAP wiring, auth, stdio versus HTTP, permission scoping and audit.
- How to add AI agents to SAP S/4HANAAdd AI agents to SAP S/4HANA through released OData APIs, BAPIs and events, with a tool layer, read-first scoping and human approval before any posting.