[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4
SEQ. 5
SEQ. 6

Defining & Executing Tools

🔧 Tool Use & Function Calling⏱ 10 min⭐ 70 BASE XP⌨ HANDS-ON LAB

Passing Tools to Models

To let an LLM use a tool, you define its signature using a JSON Schema. The LLM doesn't execute the code-it asks you to execute it.

{
  "name": "get_weather",
  "description": "Get the current weather in a given location.",
  "input_schema": {
    "type": "object",
    "properties": {
      "location": { "type": "string", "description": "City name" }
    },
    "required": ["location"]
  }
}

The Handshake

  1. Send prompt + tools array.
  2. Model responds with tool_use intent (e.g., location="Tokyo").
  3. Your code executes get_weather("Tokyo").
  4. You send the result back as a tool_result message.
⌨ HANDS-ON LABValidate Tool JSON Schema Signature
⭐ +150 XP

Inspect and validate a tool definition JSON Schema with required arguments and type constraints before dispatching to an agent.

1Validate tool JSON schema signature and required properties.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 1
Who actually executes the code when an agent calls a tool?
The LLM provider's servers
Your local application/orchestrator code
The user's browser
A third-party executing service