Ep 14: Giving Agents Hands — Connecting Calculator, Wikipedia & Custom Tools

⏱ Est. reading time: 12 min Updated on 4/9/2026

An Agent Without Tools Is Incomplete

An AI Agent without Tools is like a person with a mouth but no hands — articulate but unable to act.

graph LR
    subgraph "Toolless Agent"
        Q1["User: 15% of 8437?"] --> A1["🤖 About 1265...
❌ May miscalculate"] end subgraph "Tool-equipped Agent" Q2["User: 15% of 8437?"] --> Think["🧠 Need precision"] Think --> Calc["🔧 Calculator: 8437×0.15"] Calc --> A2["🤖 Exactly 1265.55 ✅"] end style Calc fill:#ff6d5b,stroke:#e55a4e,color:#fff

1. Function Calling Mechanism

sequenceDiagram
    participant User as 👤 User
    participant Agent as 🤖 AI Agent
    participant LLM as 🧠 GPT-4o
    participant Tool as 🔧 Calculator
    
    User->>Agent: "What's 15% of 8437?"
    Agent->>LLM: Message + Available tools list
    Note over LLM: Tools available:
1. calculator(expr)
2. wikipedia(query)
Choosing: calculator LLM-->>Agent: Tool Call: calculator("8437 * 0.15") Agent->>Tool: Execute: 8437 * 0.15 Tool-->>Agent: Result: 1265.55 Agent->>LLM: Tool result: 1265.55 LLM-->>Agent: "15% of 8437 is 1265.55" Agent-->>User: "15% of 8437 is 1265.55"

The LLM doesn't execute tools. It tells the Agent "I want to call calculator with 8437*0.15." The Tool node does the actual execution.

2. Built-in AI Tools

Tool Purpose Setup
Calculator Precise math ⭐ Zero config
Wikipedia Knowledge lookup ⭐ Zero config
SerpAPI Search Google search ⭐⭐ Needs API Key
Code Tool Custom JS/Python ⭐⭐⭐ Write code
HTTP Request Tool Call any REST API ⭐⭐ Configure URL/Auth
Workflow Tool Call another n8n workflow ⭐⭐ Create sub-workflow first

3. HTTP Request Tool: Custom Tools

// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Let Agent call your company's internal API
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

// Tool Name: "query_inventory"
// Tool Description:
//   "Query real-time product inventory by product name.
//    Input: product name (string)
//    Output: {stock: number, warehouse: string}
//    Use ONLY when user asks about stock/quantity/warehouse."

// URL: https://api.company.com/inventory
// Query: product={{ $fromAI('productName') }}
//   ↑ $fromAI() lets LLM auto-extract the parameter from conversation

4. Tool Description Best Practices

// ❌ BAD (too vague): "Query product info"
// → Agent doesn't know when to use it or what it returns

// ✅ GOOD (precise & bounded):
// "Query real-time inventory and warehouse location by product name.
//  Input: product name (Chinese text)
//  Output: JSON {stock: number, warehouse: string}
//  Use when: user explicitly asks about stock, quantity, or warehouse
//  Do NOT use for: prices, product details, order status"

// Rules:
// 1. One sentence: what does it do
// 2. Specify input format
// 3. Specify output format
// 4. When to use (positive)
// 5. When NOT to use (negative)

Next Episode

Ep 15 explores advanced prompt engineering — how to precisely guide LLMs to make optimal tool choices across 10+ available tools.