Lesson

Introduction to Function Calling (Tools)

Up until now, Claude has been trapped in a box. It only knows what is in its training data (which stops at a certain date), and it can only output text.

If you ask Claude, "What is the weather in London right now?", it will tell you it doesn't know, because it doesn't have internet access.

Function Calling (also known as Tool Use) changes everything. It gives Claude hands.

What is Function Calling?

Function calling allows you to give Claude a list of tools it can use.

Imagine you write a JavaScript function called getWeather(city) that fetches live weather data from an external API.

You can pass a description of that tool to Claude.

  1. The user asks Claude: "Do I need an umbrella in London today?"
  2. Claude reads the prompt and realizes, I don't know the weather, but I have a tool called getWeather!
  3. Claude pauses the conversation. Instead of replying to the user, Claude sends a message to your code saying: "Hey, run getWeather with the argument city: 'London'."
  4. Your Node.js code runs the function, gets the live weather data, and hands it back to Claude.
  5. Claude reads the live data and finally replies to the user: "Yes, it is currently raining in London. Take an umbrella!"

The Flow of Data

This is the most complex topic in the Intermediate course because the flow of data ping-pongs back and forth between Claude and your server.

  1. User -> Your App: User asks a question.
  2. Your App -> Claude: You send the prompt AND a list of tools.
  3. Claude -> Your App: Claude says, "Stop. I need to use a tool. Run getWeather('London')."
  4. Your App -> External API: Your code actually runs the weather check.
  5. Your App -> Claude: You send the weather results back to Claude.
  6. Claude -> Your App: Claude generates the final human-readable answer.

Claude never executes the code itself. Claude just tells your code what to execute, and waits for you to hand it the results.

In the next lesson, we will look at exactly how to define a tool and send it in the API payload.

Ready to test your understanding? Take the quiz to reinforce what you learned.

© 2026 Ant Skillsv.26.07.07-23:01