Skip to main content

Weather API Integration

This use case shows how to integrate WeatherAPI.com with HandsAI so your LLM can query current weather for any city in real-time.

What It Does

The Weather API integration allows your LLM to:
  • Get current weather conditions for any city
  • Access temperature, humidity, wind speed, and more
  • Receive real-time data from WeatherAPI.com

Setup

1. Get Your API Key

  1. Sign up for a free account at WeatherAPI.com
  2. Copy your API key from the dashboard

2. Import the Configuration

Import the Weather API configuration using the HandsAI import endpoint:
curl -X POST http://localhost:8080/api/import/providers \
  -H "Content-Type: application/json" \
  -d '[{
    "name": "API Weather",
    "code": "weather",
    "baseUrl": "https://api.weatherapi.com",
    "authenticationType": "API_KEY",
    "apiKeyLocation": "QUERY_PARAMETER",
    "apiKeyName": "key",
    "apiKeyValue": "YOUR_API_KEY_HERE",
    "tools": [
      {
        "name": "Servicio de clima",
        "code": "api-clima",
        "description": "Obtiene el clima actual para una ciudad específica.",
        "endpointPath": "/v1/current.json",
        "httpMethod": "GET",
        "parameters": [
          {
            "name": "q",
            "type": "STRING",
            "description": "Nombre de la ciudad",
            "required": true,
            "defaultValue": ""
          }
        ]
      }
    ]
  }]'
Replace YOUR_API_KEY_HERE with your actual WeatherAPI key.

3. Verify the Tool is Available

Check that the tool is registered and available:
curl http://localhost:8080/mcp/tools/list
You should see "Servicio de clima" in the tools list.

Example Tool Call

Once configured, your LLM can call the weather tool automatically. Here’s what happens behind the scenes: User asks:
“What’s the current weather in Buenos Aires?”
LLM calls the tool:
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "Servicio de clima",
    "arguments": {
      "q": "Buenos Aires"
    }
  },
  "id": "msg_123"
}
HandsAI executes:
GET https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=Buenos+Aires

Real Response Format

WeatherAPI returns comprehensive weather data:
{
  "location": {
    "name": "Buenos Aires",
    "region": "Ciudad Autónoma de Buenos Aires",
    "country": "Argentina",
    "lat": -34.61,
    "lon": -58.38,
    "tz_id": "America/Argentina/Buenos_Aires",
    "localtime": "2026-03-03 12:30"
  },
  "current": {
    "temp_c": 15.0,
    "temp_f": 59.0,
    "condition": {
      "text": "Partly cloudy",
      "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png"
    },
    "wind_kph": 13.0,
    "wind_dir": "SE",
    "humidity": 67,
    "feelslike_c": 14.2,
    "uv": 4.0
  }
}

Use in Claude, Antigravity, or Any MCP Client

With HandsAI Bridge configured, your MCP client can use this tool immediately:
{
  "mcpServers": {
    "handsai": {
      "command": "/path/to/handsai-mcp",
      "args": ["mcp"]
    }
  }
}
The LLM will automatically discover and use the weather tool when users ask weather-related questions.

Next Steps

Social Media

Post to multiple platforms with Ayrshare

Email

Send emails with Resend API

Build docs developers (and LLMs) love