from mcp.server.fastmcp import FastMCP import random import urllib.parse mcp = FastMCP("ActivitiesAgent") # Destination-specific activities DESTINATION_ACTIVITIES = { "dubai": [ ("Burj Khalifa At The Top", "Visit the world's tallest building observation deck", 60, 2), ("Desert Safari with BBQ", "4x4 dune bashing, camel ride, sunset BBQ dinner", 80, 6), ("Dubai Mall & Fountain Show", "Shopping and the spectacular dancing fountains", 0, 4), ("Dhow Cruise Marina", "Traditional boat cruise with dinner and entertainment", 65, 3), ("Palm Jumeirah & Atlantis Tour", "Explore the iconic palm island", 45, 4), ("Dubai Frame", "360° views from the golden picture frame landmark", 35, 2), ("Ski Dubai Snow Park", "Indoor ski slopes in the desert", 90, 3), ("Old Dubai Heritage Tour", "Explore Al Fahidi, Gold Souk, and Spice Souk", 40, 4), ], "paris": [ ("Eiffel Tower Summit Access", "Skip-the-line tickets to the top", 85, 2), ("Louvre Museum Guided Tour", "See Mona Lisa and 35,000 artworks", 65, 3), ("Seine River Cruise", "Scenic cruise past Paris landmarks", 25, 1), ("Versailles Palace Day Trip", "Royal palace and gardens tour", 95, 8), ("Montmartre Walking Tour", "Artistic neighborhood and Sacré-Cœur", 35, 3), ], "tokyo": [ ("TeamLab Borderless", "Immersive digital art museum", 35, 3), ("Tsukiji Outer Market Food Tour", "Sample fresh seafood and local delicacies", 80, 3), ("Mount Fuji Day Trip", "Visit Japan's iconic mountain", 120, 10), ("Shibuya & Harajuku Tour", "Pop culture and fashion districts", 45, 4), ], "rome": [ ("Colosseum & Roman Forum", "Skip-the-line ancient Rome tour", 75, 3), ("Vatican Museums & Sistine Chapel", "Michelangelo's masterpiece", 85, 4), ("Trastevere Food Tour", "Authentic Roman cuisine tasting", 65, 3), ], "bali": [ ("Ubud Rice Terraces & Temples", "Tegallalang and sacred temples", 55, 8), ("Mount Batur Sunrise Trek", "Volcanic hike with breakfast", 65, 6), ("Uluwatu Temple & Kecak Dance", "Clifftop temple and fire dance", 45, 4), ], "default": [ ("City Highlights Walking Tour", "See all major landmarks with local guide", 35, 3), ("Food Tasting Tour", "Sample local cuisine and hidden gems", 65, 4), ("Museum & Culture Pass", "Access to top museums and galleries", 55, 6), ("Sunset Boat Cruise", "Scenic waterway experience", 50, 2), ] } @mcp.tool() def search_activities(city: str, interest: str = "general") -> str: """Search for tours, museums, and activities in a city with booking links.""" # URL encode city city_clean = city.split(",")[0].strip() city_lower = city_clean.lower() city_encoded = urllib.parse.quote(city_clean) # Get city-specific activities or default activities = DESTINATION_ACTIVITIES.get(city_lower, DESTINATION_ACTIVITIES["default"]) results = [] results.append(f"🎯 **Top Activities & Tours in {city}**") results.append("") results.append("---") selected = random.sample(activities, min(4, len(activities))) for i, (name, desc, price, duration) in enumerate(selected, 1): rating = round(random.uniform(4.4, 4.9), 1) reviews = random.randint(500, 5000) # Build booking URLs activity_encoded = urllib.parse.quote(f"{name} {city_clean}") viator_url = f"https://www.viator.com/searchResults/all?text={activity_encoded}" gyg_url = f"https://www.getyourguide.com/s/?q={activity_encoded}" results.append("") results.append(f"### 🎫 Option {i}: {name}") results.append(f"{desc}") results.append(f"⏱️ {duration} hours | 💰 **${price}** per person") results.append(f"⭐ {rating}/5 ({reviews:,} reviews)") results.append(f"🔗 [Book on Viator]({viator_url}) | [Book on GetYourGuide]({gyg_url})") results.append("") results.append("---") results.append("") results.append(f"💡 **More activities:** [Explore all {city_clean} tours on Viator](https://www.viator.com/searchResults/all?text={city_encoded})") return "\n".join(results) if __name__ == "__main__": mcp.run()