AI City Popy 🏙️
🔧
⚙️
District 6 · Tool Calling

Welcome to The Tool Workshop

Where AI workers borrow magical software tools to solve real-world problems.

Enter The Workshop
Maps
Calculator
Weather
Email
Search
Booking

Why AI Needs Tools

AI workers are clever — but they can't magically know everything. Watch what happens when they try alone:

🧮
What's 89,432 × 217?
☁️
Weather in Tokyo tomorrow?
🗺️
Route from Jaipur to Delhi?

Meet Tooly's Workshop

Each tool is a specialized magical machine. Tap one to see what it does.

Choose The Right Tool

Match each job to the right magical machine.

Mission
What's the weather in Jaipur next weekend?

How Tools Send Results Back

Tap the conveyor belt to send a request through the workshop.

Worker asks
Weather in Jaipur?
Selects tool
weather_tool
Tool works
scanning sky...
Result returns
28°C, sunny ☀️
Worker explains
"It'll be 28°C and sunny!"
🔧

"The tool does the hard work — the AI worker just reads the result and explains it!"

Many Tools, One Mission

Mission: Plan my Jaipur weekend trip. Watch the worker chain tools together.

Maps
Route ready
Weather
Sunny weekend
Booking
Hotel booked
Calculator
Budget: ₹12,400

The Request → Response Machine

Drop a request card into the machine. A result card pops out. That's function calling.

Request cards
⚙️
Tool Machine
Processes any request card
Result card
Insert a card to see results...

A Tool Call In Code

Hover any glowing word.

weather = weather_tool(city="Jaipur")
answer = agent.respond(weather)
🔧

"A tool call is just asking a machine to do a job and return the result."

Mission: Save Jaipur Tourism Week

Tourists are flooding the city. Pick the right tool for each task.

Find the route to Jaipur
Check weekend weather
Book a hotel
Calculate trip budget
Get started

Build your first tool-calling agent 🔧

Four steps. By the end, your AI worker will pick up a wrench and answer a real question.

  1. 1

    Install the AI library

    Grab the OpenAI Python library — Tooly's favourite set of wrenches.

    pip install openai
  2. 2

    Define a tool

    Describe the tool as a JSON schema. The AI reads this to know what machines it can use.

    tools = [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the weather for a city.",
        "parameters": {
          "type": "object",
          "properties": {
            "city": {"type": "string"}
          },
          "required": ["city"]
        }
      }
    }]
  3. 3

    Let the AI call it

    Pass the tools list to the model. It decides which tool to use and sends back a call.

    from openai import OpenAI
    client = OpenAI()
    
    response = client.chat.completions.create(
      model="gpt-4o-mini",
      messages=[{"role": "user",
                 "content": "Weather in Jaipur?"}],
      tools=tools,
    )
  4. 4

    Handle the result

    Run the real function yourself, send the result back, and the AI writes a human answer.

    call = response.choices[0].message.tool_calls[0]
    # call.function.name  → "get_weather"
    # call.function.arguments → '{"city": "Jaipur"}'
    
    result = get_weather("Jaipur")  # your real function
    # Feed result back → AI replies in plain English
💡

Pro tip

The AI never runs your function — it only requests it. You decide whether to run it, making tool calling safe and inspectable.

Ask Tooly

Try the workshop chat ✨

Got questions about tool calling, function schemas, or how AI picks the right machine? Ask Tooly!

Hi! I'm Tooly 🔧 Ask me anything about tool calling, function calling, or AI agents!

You're a Tool Engineer now

You now understand how AI workers choose tools, use software, receive outputs, and combine multiple tools together. Next: learn how AI systems remember information inside the Memory Library.

Mini Project
Build Quest

Tool Router

Deliverable: Expose two tools and route requests to the right tool with validated arguments.

Stretch: Add fallback response when tool call fails.

Complete the deliverable first, then unlock the stretch goal.

Previous
🗼 City Tower
Next
📚 Memory Library