What Are Function Calling and Tool Use in LLMs?
SkillVeris Team
AI Research Team

Function calling, also called tool use, lets an LLM ask your application to run a predefined function by returning structured arguments instead of plain text.
In this guide, you'll learn:
- You describe the available tools with names, descriptions, and a parameter schema, and the model decides when and how to call them.
- The model does not run the function itself; it emits a request, your code executes it, and you send the result back.
- Tool use connects a language model to live data and real actions like databases, APIs, and calculations.
- Clear tool names, descriptions, and schemas are what make the model call the right function with valid arguments.
1What Are Function Calling and Tool Use?
Function calling, also known as tool use, is a capability that lets a language model ask your application to run a specific function. Instead of replying with prose, the model returns a structured request naming the function and the arguments to pass it. Your code runs the function and hands the result back to the model, which then continues the conversation.
This is how an LLM breaks out of its own head. On its own it can only generate text, but with tools it can fetch a live weather report, query a database, do exact math, or trigger an action, all by requesting the right function at the right moment.
2Why Tool Use Matters
A language model alone is frozen at its training cutoff and cannot access anything new or private. Tool use removes that ceiling by letting the model reach into your systems and the wider world.
- Live data: fetch current prices, weather, or inventory the model never saw.
- Private data: query your own databases and documents securely.
- Reliable computation: offload exact math and logic to real code.
- Real actions: send an email, create a ticket, or update a record.
🔑Key Idea
The model decides what to do; your code does it. Function calling separates reasoning from execution, so the LLM plans the action and your application safely carries it out.
3How Function Calling Works
The flow is a short round trip. You provide the model with a list of tools and the user's message. If the model decides a tool is needed, it responds not with an answer but with a function-call request containing the chosen function name and arguments matching your schema.
Your application executes that function, captures the result, and sends it back to the model in a follow-up call. The model then uses the result to produce its final natural-language answer.
- 1. You send the message plus tool definitions to the model.
- 2. The model returns a function call with a name and arguments.
- 3. Your code runs the function and gets a result.
- 4. You send the result back and the model replies to the user.
4Defining Tools Well
The model can only use tools you describe clearly. Each tool definition includes a name, a plain-language description of what it does and when to use it, and a parameter schema specifying the arguments, their types, and which are required.
The description is effectively a prompt. A well-written one helps the model pick the right tool and fill in valid arguments, while a vague one leads to missed or malformed calls.
A Tool Definition's Parts
Think of a tool definition as a contract the model reads before deciding to call it.
name: a short identifier like get_weather.
description: what it does and when to use it.
parameters: a schema of arguments with types and required fields.
returns: what the result looks like, so the model can use it.5Validating and Securing Tool Calls
The model produces arguments that look right but are not guaranteed to be correct or safe. Before executing any tool, validate the arguments against your schema, check permissions, and sanitize inputs, exactly as you would for input from an untrusted user.
This matters most for tools that change state or touch sensitive systems. A model might request a delete with the wrong id or pass a value outside allowed ranges, so your code must be the gatekeeper.
⚠️Watch Out
Never let the model's arguments flow straight into a database write, shell command, or payment. Treat every tool call as untrusted input and validate it before you act.
6Chaining Multiple Tools
Real tasks often need several tools in sequence. The model can call one tool, read the result, then decide to call another, building up to an answer over multiple turns. This agentic loop is how assistants handle requests like find my latest order and email me the receipt.
Your application runs the loop: pass tools and message, execute any requested call, feed the result back, and repeat until the model produces a final answer instead of another tool request.
- The model can call tools one after another to complete a task.
- Each result informs the model's next decision.
- Your app loops until the model returns a final answer.
- Set a call limit to prevent infinite or runaway loops.
7Best Practices
Reliable tool use is mostly about clarity and guardrails.
- Write descriptive tool names and descriptions so the model chooses well.
- Keep parameter schemas strict with explicit types and required fields.
- Validate every argument before executing anything.
- Return clear, structured results the model can reason over.
- Cap the number of tool calls per request to bound cost and loops.
8Common Mistakes to Avoid
Tool use fails in predictable ways, usually around definitions and trust.
- Vague tool descriptions that leave the model guessing when to call them.
- Loose schemas that let the model pass malformed arguments.
- Executing tool calls without validating the arguments first.
- Assuming the model runs the function itself instead of your code.
- No limit on chained calls, allowing runaway loops and cost.
9Key Takeaways
Function calling boils down to a few core ideas.
- Tool use lets an LLM request that your code run a defined function.
- The model returns structured arguments; your application executes them.
- It connects the model to live data, private systems, and real actions.
- Clear names, descriptions, and schemas drive correct tool selection.
- Always validate arguments before acting on a tool call.
10Frequently Asked Questions
Q: Does the LLM actually run the function? A: No. The model only returns a request naming the function and its arguments. Your application executes the function and sends the result back, which keeps you in control of what actually runs.
Q: What is the difference between function calling and tool use? A: They refer to the same capability. Function calling emphasizes the mechanism of returning a structured function request, while tool use emphasizes the broader idea of giving the model access to external capabilities. In practice the terms are interchangeable.
Q: How does the model know which tool to use? A: It reads the tool definitions you provide, especially the name and description, and matches them to the user's intent. Clear, specific descriptions are the biggest factor in the model choosing the right tool.
Q: Is tool use safe? A: It is as safe as you make it. The model can produce plausible but wrong arguments, so you must validate inputs, check permissions, and sanitize anything before executing, particularly for tools that change data or take real-world actions.
Related Reading
Get The Print Version
Download a PDF of this article for offline reading.
About the Publisher
SkillVeris Team
AI Research Team
Our AI team covers the latest in machine learning, generative AI, and emerging tech — clearly and accurately.
View all postsRelated Posts
Never miss an update
Get the latest tutorials and guides delivered to your inbox.
No spam. Unsubscribe anytime.