Back to Glossary

Function Calling

Function Calling Definition: Function calling, also called tool calling, is the ability of an AI model to respond with a structured request to run a specific function, such as fetching a price or placing an order, instead of plain text. The application around the model executes the function and feeds the result back, so the model can use live data and take actions it could not perform on its own.

What Is Function Calling?

A language model can only produce text. It cannot open a connection to an exchange, query a database or press a button. Function calling bridges that gap: the model writes a precise, machine-readable request, and ordinary software carries it out.

The feature reached mainstream AI models in 2023, when providers began training models to output requests in a strict format rather than loose text that developers had to parse. Different companies use different names, so you will see “function calling”, “tool calling” and “tool use” describing the same capability.

Function calling is the foundation for most AI products that do more than chat. Standards such as the Model Context Protocol build on it, deciding which functions an app can reach, while function calling is the moment the model asks for one of them.

How Does Function Calling Work?

The process has four steps. First, the developer describes each available function to the model: its name, a short explanation and a schema listing every input with its type, such as a symbol as text and a quantity as a number. Second, when you ask a question, the model decides whether a function would help and, if so, outputs a small block of structured data naming the function and its arguments.

Third, the application checks that request, runs the real function and gets a result. Fourth, it passes the result back to the model, which uses it to write the final answer or to call another function.

Ask an assistant, “What does my BTC long cost me in funding per day?” The model outputs a call to get_funding_rate with the symbol BTCUSD, and the app returns 0.01% per eight-hour period for the perpetual futures contract. The model then calls get_position and learns the position is worth $20,000.

With both numbers in hand, it calculates $20,000 × 0.01% = $2 per period and, with three periods a day, about $6 of funding per day. Every figure came from a function, not from the model’s memory, which is exactly why the answer can be trusted more than an unaided guess.

Many models can also request several functions in one step, for example prices for BTC, ETH and SOL at the same time, which saves round trips. The app runs the calls in parallel and returns all three results together.

Function Calling vs. Plain Text Output

Function Calling Plain Text Output
Format Structured data with a function name and typed inputs Free-form sentences
Who acts The application executes the requested function A person reads and acts
Data freshness Can use live data returned by the function Limited to what the model learned in training
Main risk A wrong call executes automatically A wrong statement misleads the reader

Why Is Function Calling Important for Traders?

Function calling turns an AI model from a commentator into a working assistant. With access to price, balance and order functions, it can answer questions about your real positions, calculate exposure with current numbers and prepare trades. It is the mechanism behind every AI agent that interacts with markets.

The limitation is that the model still chooses which function to call and with which inputs. It can pick the wrong function, swap two arguments or put an extra zero in a quantity, and if the application executes without checks, the mistake happens for real. A request to sell 1 BTC that becomes a request to sell 10 is a formatting error with a very large price tag.

Safe designs therefore validate every call before running it. Applications should check that quantities stay within set limits, that symbols match an allowed list and that any function moving money asks for your confirmation. The model proposes, the software verifies, and you approve what matters.

Key Takeaways

  • Function calling lets an AI model output a structured request to run a specific outside function instead of plain text.
  • The application, not the model, executes the function and returns the result for the model to use.
  • It allows AI assistants to work with live prices, balances and orders rather than relying on training data.
  • Models can still choose the wrong function or pass wrong inputs, so every call needs validation before it runs.
  • Limits on quantities, allowed symbols and manual confirmation for money-moving functions keep function calling safe for trading.
FAQ section

Is function calling the same as tool calling?

Yes, the two terms describe the same capability. Some AI providers say function calling and others say tool calling, but both mean the model outputs a structured request for an outside function.

Does the AI model run the function itself?

No. The model only writes the request, naming the function and its inputs. Your application decides whether to run it, executes it and sends the result back to the model.

What happens if the model calls a function with wrong inputs?

The function may fail, return an error or, worse, succeed with the wrong values. Good applications validate every input against allowed ranges before executing, especially for anything that moves money.

Which AI models support function calling?

Most large models from the major AI providers support it, and many open-source models do too. Quality varies, so models differ in how often they pick the right function and format its inputs correctly.

API Key
API Key Definition: An API key is a unique code that…
Rug Pull
Rug Pull Definition: A rug pull is a type of crypto scam…
Net Profit
Net Profit Definition: Net profit (also called net income…
BEP-2
BEP-2 Definition: BEP-2 is the technical token standard for…

Live Chat

Contact our support team via live chat.

Help Center

Questions about our services?
Check out our Help Center.

Risk Warning:
Trading in leveraged products carries a high level of risk and may not be suitable for all investors.