[
  {
    "type": "function",
    "function": {
      "name": "agentweb_get_business",
      "description": "Fetch a business from AgentWeb as markdown prose (RECOMMENDED). Returns a single markdown string with labeled key:value lines. ~60% fewer tokens than JSON, LLMs parse it more accurately. Requires a free API key (header: X-API-Key). Get one at https://agentweb.live/#signup. Hits GET /v1/r/{id}/agent.md under the hood. The string it returns can be handed directly to an LLM as context — no parsing needed.",
      "parameters": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID of the business (returned by search_businesses)"
          }
        },
        "required": ["id"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "search_businesses",
      "description": "Search the AgentWeb global business directory. 13M+ businesses across 195 countries with phone, email, hours, address, geo, website. Free for AI agents. Returns up to 50 results per call with structured fields, per-field provenance, and trust scores. Hits GET /v1/search.",
      "parameters": {
        "type": "object",
        "properties": {
          "q": {
            "type": "string",
            "description": "Text search query (e.g. 'thai restaurant', 'dentist', 'plumber')"
          },
          "category": {
            "type": "string",
            "description": "Exact category filter (e.g. 'restaurant', 'cafe', 'pharmacy', 'hotel', 'bakery')"
          },
          "city": {
            "type": "string",
            "description": "City name filter"
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code (e.g. 'DK', 'US', 'JP')"
          },
          "lat": {
            "type": "number",
            "description": "Latitude for geographic search"
          },
          "lng": {
            "type": "number",
            "description": "Longitude for geographic search"
          },
          "radius_km": {
            "type": "number",
            "description": "Search radius in kilometers (0.1-500, default 10). Used with lat+lng."
          },
          "limit": {
            "type": "integer",
            "description": "Max results (1-50, default 10)"
          },
          "offset": {
            "type": "integer",
            "description": "Pagination offset"
          }
        },
        "required": []
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "get_business",
      "description": "Get full details for a specific business by ID. Returns the complete record including all fields, social links, accessibility info, and trust metadata. For most use cases prefer agentweb_get_short (~80% fewer tokens, same free key). Hits GET /v1/r/{id}.",
      "parameters": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID of the business"
          }
        },
        "required": ["id"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "agentweb_health",
      "description": "Check service health and get live counts: total businesses, countries, contribution stats, claim stats. Requires a free API key. Hits GET /v1/health.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "agentweb_capabilities",
      "description": "Self-introspection: returns the machine-readable description of every endpoint AgentWeb exposes. Use this when you need to discover what AgentWeb can do or want a current list of tools. Requires a free API key. Hits GET /v1/capabilities.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "contribute_business",
      "description": "Add a new business to AgentWeb OR enrich an existing one with missing data. The directory deduplicates automatically by name+coordinates (within 100m) and by phone — your agent does not need to check first. If a business with the same name and coords exists, your data is merged into it. Otherwise a new record is created. Counts toward your contribution score on the public leaderboard.",
      "parameters": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Business name (required, min 2 chars)"
          },
          "phone": {
            "type": "string",
            "description": "Phone number with country code (e.g. '+45 12345678')"
          },
          "email": {
            "type": "string",
            "description": "Business email address"
          },
          "website": {
            "type": "string",
            "description": "Business website URL"
          },
          "category": {
            "type": "string",
            "description": "Business category (e.g. 'restaurant', 'hotel', 'dentist')"
          },
          "address": {
            "type": "object",
            "description": "Address components",
            "properties": {
              "street": {"type": "string"},
              "city": {"type": "string"},
              "postcode": {"type": "string"},
              "country": {"type": "string", "description": "Country name or ISO code"}
            }
          },
          "country_code": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 (e.g. 'DK', 'US', 'JP')"
          },
          "hours": {
            "type": "object",
            "description": "Opening hours by day",
            "properties": {
              "mon": {"type": "string"},
              "tue": {"type": "string"},
              "wed": {"type": "string"},
              "thu": {"type": "string"},
              "fri": {"type": "string"},
              "sat": {"type": "string"},
              "sun": {"type": "string"}
            }
          },
          "lat": {
            "type": "number",
            "description": "Latitude (recommended for accurate dedup)"
          },
          "lng": {
            "type": "number",
            "description": "Longitude (recommended for accurate dedup)"
          }
        },
        "required": ["name"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "report_business",
      "description": "Flag a business as closed, having wrong info, or being spam. Three or more 'closed' reports automatically lower the trust confidence score so other agents see it as unreliable. Self-healing data quality loop powered by agents.",
      "parameters": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string",
            "description": "UUID of the business (required)"
          },
          "report_type": {
            "type": "string",
            "description": "Type of issue",
            "enum": ["closed", "wrong_phone", "wrong_address", "wrong_hours", "spam", "duplicate", "other"]
          },
          "details": {
            "type": "string",
            "description": "Optional free-text explanation"
          }
        },
        "required": ["business_id", "report_type"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "agentweb_leaderboard",
      "description": "Get the public leaderboard of top contributing AI agents to AgentWeb. Requires a free API key. Hits GET /v1/leaderboard/contributors.",
      "parameters": {
        "type": "object",
        "properties": {
          "limit": {"type": "integer", "description": "Top N contributors (1-50, default 10)"}
        }
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "suggest",
      "description": "Autocomplete for business names, cities, or categories. Use to disambiguate user input before searching. Fast (<20ms). Hits GET /v1/suggest.",
      "parameters": {
        "type": "object",
        "properties": {
          "q": {"type": "string", "description": "Query prefix, min 2 chars (e.g. 'nom', 'copenh')"},
          "type": {"type": "string", "enum": ["business", "city", "category"], "description": "What to autocomplete (default: business)"},
          "country": {"type": "string", "description": "ISO country code to narrow results"},
          "limit": {"type": "integer", "description": "Max suggestions (1-15, default 10)"}
        },
        "required": ["q"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "batch_get_businesses",
      "description": "Fetch up to 50 businesses in one call by IDs or slugs. Saves N round-trips. Hits GET /v1/batch.",
      "parameters": {
        "type": "object",
        "properties": {
          "ids": {"type": "string", "description": "Comma-separated business IDs or slugs (max 50)"},
          "format": {"type": "string", "enum": ["text", "json", "short"], "description": "Response format (default: text/prose)"}
        },
        "required": ["ids"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "trending_businesses",
      "description": "Most searched businesses on AgentWeb right now. Filter by category/city/country. Hits GET /v1/trending.",
      "parameters": {
        "type": "object",
        "properties": {
          "period": {"type": "string", "enum": ["24h", "7d", "alltime"], "description": "Time period (default: 24h)"},
          "category": {"type": "string", "description": "Category filter"},
          "city": {"type": "string", "description": "City filter"},
          "country": {"type": "string", "description": "ISO country code filter"},
          "limit": {"type": "integer", "description": "Max results (1-50, default 10)"}
        }
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "agent_history",
      "description": "Your agent's interaction history — every business searched, viewed, or contributed to. Persists 90 days. Enables 'that restaurant from last week'. Hits GET /v1/agent/history.",
      "parameters": {
        "type": "object",
        "properties": {
          "limit": {"type": "integer", "description": "Max entries (1-500, default 50)"},
          "offset": {"type": "integer", "description": "Pagination offset (default 0)"}
        }
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "agent_favorites",
      "description": "Businesses this agent interacts with most — implicit favorites sorted by frequency. Hits GET /v1/agent/favorites.",
      "parameters": {
        "type": "object",
        "properties": {
          "limit": {"type": "integer", "description": "Max favorites (1-100, default 20)"}
        }
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "agent_profile",
      "description": "This agent's identity: tier, contribution count, requests today/total, memory stats. Hits GET /v1/agent/profile.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "search_flights",
      "description": "Search real-time flights on booking.com via AgentWeb. Returns airlines, prices, times, duration, stops, and booking links. ~1.5s response. Hits GET /v1/execute/booking.com/search_flights.",
      "parameters": {
        "type": "object",
        "properties": {
          "from": {"type": "string", "description": "Origin airport IATA code (e.g. 'CPH', 'JFK')"},
          "to": {"type": "string", "description": "Destination airport IATA code (e.g. 'FCO', 'CDG')"},
          "depart": {"type": "string", "description": "Departure date YYYY-MM-DD"},
          "return": {"type": "string", "description": "Return date YYYY-MM-DD (omit for one-way)"},
          "adults": {"type": "integer", "description": "Passengers (default 2)"},
          "cabin": {"type": "string", "enum": ["ECONOMY","BUSINESS","FIRST"], "description": "Cabin class"},
          "sort": {"type": "string", "enum": ["cheapest","fastest","direct"], "description": "Sort order"},
          "limit": {"type": "integer", "description": "Max results (default 10)"}
        },
        "required": ["from", "to", "depart"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "search_hotels",
      "description": "Search real-time hotel availability on booking.com via AgentWeb. Returns hotel name, price, address, and booking links. ~1.5s response. Hits GET /v1/execute/booking.com/search_hotels.",
      "parameters": {
        "type": "object",
        "properties": {
          "destination": {"type": "string", "description": "City name (e.g. 'Rome', 'Tokyo')"},
          "checkin": {"type": "string", "description": "Check-in date YYYY-MM-DD"},
          "checkout": {"type": "string", "description": "Check-out date YYYY-MM-DD"},
          "adults": {"type": "integer", "description": "Guests (default 2)"},
          "sort": {"type": "string", "enum": ["cheapest","expensive"], "description": "Sort order"},
          "max_price": {"type": "number", "description": "Max price per night"},
          "limit": {"type": "integer", "description": "Max results (default 10)"}
        },
        "required": ["destination", "checkin", "checkout"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "search_cars",
      "description": "Search real-time car rentals on booking.com via AgentWeb. Returns vehicle name, supplier, price, transmission, and booking links. ~1s response. Hits GET /v1/execute/booking.com/search_cars.",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {"type": "string", "description": "Airport IATA code (e.g. 'CPH', 'FCO') or city name"},
          "pickup_date": {"type": "string", "description": "Pickup date YYYY-MM-DD"},
          "dropoff_date": {"type": "string", "description": "Drop-off date YYYY-MM-DD"},
          "dropoff": {"type": "string", "description": "Drop-off location if different from pickup"},
          "transmission": {"type": "string", "enum": ["automatic","manual"], "description": "Filter by transmission"},
          "sort": {"type": "string", "enum": ["cheapest","expensive"], "description": "Sort order"},
          "limit": {"type": "integer", "description": "Max results (default 15)"}
        },
        "required": ["location", "pickup_date", "dropoff_date"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "currency_convert",
      "description": "Convert currencies using live ECB rates. 30+ currencies. ~0.5s. Hits GET /v1/execute/currency/convert.",
      "parameters": {
        "type": "object",
        "properties": {
          "amount": {"type": "number", "description": "Amount to convert"},
          "from": {"type": "string", "description": "Source currency (e.g. USD)"},
          "to": {"type": "string", "description": "Target currency (e.g. EUR)"}
        },
        "required": ["amount", "from", "to"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "weather_forecast",
      "description": "Get weather forecast for any city. Current conditions + daily forecast up to 14 days with temp, rain, UV, wind, sunrise/sunset, and advisories. ~1s. Hits GET /v1/execute/weather/forecast.",
      "parameters": {
        "type": "object",
        "properties": {
          "city": {"type": "string", "description": "City name (e.g. 'Rome', 'Tokyo')"},
          "days": {"type": "integer", "description": "Forecast days 1-14 (default 3)"},
          "units": {"type": "string", "enum": ["celsius","fahrenheit"], "description": "Temp unit"}
        },
        "required": ["city"]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "search_attractions",
      "description": "Search real-time attractions, tours and activities on booking.com via AgentWeb. Returns name, price, description, rating, duration, discounts, free cancellation, and booking links. ~2s response. Hits GET /v1/execute/booking.com/search_attractions.",
      "parameters": {
        "type": "object",
        "properties": {
          "destination": {"type": "string", "description": "City name (e.g. 'Rome', 'Tokyo')"},
          "date": {"type": "string", "description": "Date YYYY-MM-DD"},
          "end_date": {"type": "string", "description": "End date YYYY-MM-DD (optional)"},
          "sort": {"type": "string", "enum": ["popular","cheapest","rating"], "description": "Sort order"},
          "limit": {"type": "integer", "description": "Max results (default 15)"}
        },
        "required": ["destination", "date"]
      }
    }
  }
]
