AI & Agents

Tool Use & Function Calling

Discover how AI moves beyond talking and starts doing — searching the web, running code, sending emails, and more.

Scroll to start

What Is Tool Use in AI?

Think of a regular AI chatbot like a really smart friend who can answer almost any question — but stays glued to their chair. They can tell you the weather, write code, or explain history. But they can't actually go check the weather for you, run that code, or post something online.

Tool use changes that. It gives AI "hands" — a way to reach out and do things in the real world. When an AI can use tools, it stops being just a talker and becomes a doer.

Function calling (or tool calling) is the technical name for this. It's a structured way for an AI to say: "I need to do something. Here's what I'm going to do and what information I need."

Key Insight

Without tools, AI is like a librarian who can describe every country in the world but has never left the library. With tools, the librarian can pack a bag and go.

Why Should You Care?

Here's the thing: text is limited. A chat-only AI can give you information, but it can't change anything outside the chat window. It doesn't know what time it is right now. It doesn't know what files are on your computer. It can't check your email or update a spreadsheet.

Tool use fixes that gap. It lets AI connect to the internet, run programs, read and write files, use APIs, and much more. This is the difference between an AI that recommends and an AI that does.

For builders and creators, this is huge. You can have an AI agent that searches the web for you, writes a report, emails it to your client, and schedules a follow-up — all without you touching the keyboard.

Key Insight

The real power of AI isn't just in answers — it's in actions. Tool use is what turns a clever chatbot into a useful AI employee.

The 3-Step Process

Tool use follows a simple loop. It's like a dog learning new tricks — hear the command, do the action, wait for the next one.

How an AI Uses a Tool
🤔
Decide
AI sees a question and decides it needs to act
📋
Call Tool
AI picks the right tool and sends a request
⚙️
Tool Runs
The tool does its job and returns the result
🧠
AI Responds
AI reads the result and answers you
Repeat as needed

The AI doesn't guess when to use tools — it's told ahead of time what tools are available and what each one does. This is usually written in a system prompt. The AI reads the question, checks the list of available tools, and decides which one (or ones) to call.

Function Calling In Action

Here's what a tool definition looks like — think of it as a description card that tells the AI what a tool does and how to ask for it.

tool-definition.json
// A tool definition tells the AI:
// what the tool is called, what it does,
// and what info it needs to run.
{
  "name": "get_weather",
  "description": "Get the current weather in a city",
  "parameters": {
    "type": "object",
    "properties": {
      "city": {
        "type": "string",
        "description": "The city name, e.g. Toronto"
      }
    },
    "required": ["city"]
  }
}

// When the AI decides to use the tool,
// it sends a structured request like this:
{
  "name": "get_weather",
  "arguments": { "city": "Toronto" }
}

// The tool runs and sends back real data:
{ "temperature": 14, "condition": "partly cloudy" }

The AI reads your question, decides it needs weather info, picks get_weather, fills in the city, and then uses the result to give you a real answer. No guesswork, just a clean handoff.

Knowledge Check

Test what you learned with this quick quiz.

Quiz — Tool Use & Function Calling

Question 1
What is the main limitation of a chat-only AI that tool use solves?
Question 2
What does a "tool definition" do in a function calling system?
Question 3
In the tool-use loop, what happens after the AI receives the result from a tool?
🏆

You crushed it!

Perfect score on this module.