Prompt Engineering Tutorial 0/120 lessons ~6 min read Lesson 43
Tool Calling Concepts
Tool calling (a.k.a.
Course progress0%
Focus
6 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
Tool calling (a.k.a. function calling) lets the LLM emit a structured request to call your code. You run the code, return the result, and the model continues.
Beginner analogy: Like a manager delegating: 'go fetch X from the API'. The model decides what to delegate; your code does it.
Understanding the topic
Core concepts to understand:
- Define tools with JSON schema (name, description, parameters).
- Model emits a structured 'tool call' instead of text.
- Your code executes the tool and feeds the result back.
- Modern APIs (OpenAI, Anthropic) have first-class support.
Syntax reference
Visual workflow / architecture:
bash
tools = [{ name: "get_weather",parameters: { city: "string" } },{ name: "send_email",parameters: { to, subject, body } }]Model emits: { tool: "get_weather", args: { city: "NYC" } }Code runs it → returns 22°C → model continues.
Real-world use
Every modern AI agent uses tool calling for browsing, code execution, database queries, sending emails.
Best practices
- Describe each tool with WHY to call it, not just WHAT it does.
- Cap to ~5 tools per prompt — more confuses the model.
- Validate tool arguments before executing.
Hands-on exercise
Interview preparation — practice these questions:
- Q1. What is tool calling?
- Q2. Difference from prompt-engineered 'fake' tools?
- Q3. How handle a wrong tool call?
- Q4. Why limit number of tools?
Ready to mark this lesson complete?Track your journey across the entire course.