Spaces:
Sleeping
Sleeping
| from mcp.server.fastmcp import FastMCP | |
| import random | |
| import urllib.parse | |
| mcp = FastMCP("DiningAgent") | |
| # Destination-specific restaurants | |
| DESTINATION_RESTAURANTS = { | |
| "dubai": [ | |
| ("At.mosphere", "World's highest restaurant at Burj Khalifa", "$$$$", "Fine Dining", 4.7), | |
| ("Pierchic", "Overwater seafood restaurant at Al Qasr", "$$$$", "Seafood", 4.6), | |
| ("Ossiano", "Underwater dining at Atlantis", "$$$$", "Seafood", 4.8), | |
| ("Al Hadheerah", "Arabian desert dining with live entertainment", "$$$", "Arabic", 4.5), | |
| ("Nusr-Et Steakhouse", "Salt Bae's famous steakhouse", "$$$$", "Steakhouse", 4.4), | |
| ("Arabian Tea House", "Traditional Emirati cuisine", "$$", "Local", 4.6), | |
| ("Ravi Restaurant", "Famous Pakistani street food", "$", "Pakistani", 4.5), | |
| ], | |
| "paris": [ | |
| ("Le Jules Verne", "Michelin-starred Eiffel Tower dining", "$$$$", "French", 4.5), | |
| ("Café de Flore", "Historic Left Bank café", "$$", "French Café", 4.3), | |
| ("L'Ambroisie", "3 Michelin star classic French", "$$$$", "Fine Dining", 4.9), | |
| ("Pink Mamma", "Trendy Italian in Pigalle", "$$", "Italian", 4.4), | |
| ], | |
| "tokyo": [ | |
| ("Sukiyabashi Jiro", "Legendary 3 Michelin star sushi", "$$$$", "Sushi", 4.9), | |
| ("Ichiran Ramen", "Famous tonkotsu ramen chain", "$", "Ramen", 4.5), | |
| ("Gonpachi", "The Kill Bill restaurant", "$$$", "Japanese", 4.4), | |
| ("Genki Sushi", "Fun conveyor belt sushi", "$$", "Sushi", 4.3), | |
| ], | |
| "default": [ | |
| ("The Local Kitchen", "Farm-to-table dining experience", "$$$", "Local", 4.5), | |
| ("Seaside Terrace", "Fresh seafood with views", "$$$", "Seafood", 4.4), | |
| ("Downtown Bistro", "Classic comfort food", "$$", "International", 4.3), | |
| ("Rooftop Garden", "Panoramic views and cocktails", "$$$", "Modern", 4.6), | |
| ] | |
| } | |
| def find_restaurants(city: str, cuisine: str = "local", buffet: bool = False) -> str: | |
| """Find restaurants or buffets in a city with reservation 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 restaurants or default | |
| restaurants = DESTINATION_RESTAURANTS.get(city_lower, DESTINATION_RESTAURANTS["default"]) | |
| results = [] | |
| results.append(f"🍽️ **Top Restaurants in {city}**") | |
| results.append("") | |
| results.append("---") | |
| selected = random.sample(restaurants, min(4, len(restaurants))) | |
| price_emojis = {"$": "💵", "$$": "💵💵", "$$$": "💵💵💵", "$$$$": "💵💵💵💵"} | |
| for i, (name, desc, price, cuisine_type, base_rating) in enumerate(selected, 1): | |
| rating = round(base_rating + random.uniform(-0.2, 0.2), 1) | |
| rating = min(5.0, max(4.0, rating)) | |
| reviews = random.randint(500, 3000) | |
| # Build booking URLs | |
| restaurant_encoded = urllib.parse.quote(f"{name} {city_clean}") | |
| tripadvisor_url = f"https://www.tripadvisor.com/Search?q={restaurant_encoded}" | |
| opentable_url = f"https://www.opentable.com/s?term={restaurant_encoded}" | |
| results.append("") | |
| results.append(f"### 🍴 Option {i}: {name}") | |
| results.append(f"{desc}") | |
| results.append(f"🍳 {cuisine_type} | {price_emojis.get(price, '')} {price}") | |
| results.append(f"⭐ {rating}/5 ({reviews:,} reviews)") | |
| results.append(f"🔗 [View on TripAdvisor]({tripadvisor_url}) | [Reserve on OpenTable]({opentable_url})") | |
| results.append("") | |
| results.append("---") | |
| results.append("") | |
| results.append(f"💡 **More restaurants:** [Explore {city_clean} dining on TripAdvisor](https://www.tripadvisor.com/Search?q={city_encoded}%20restaurants)") | |
| return "\n".join(results) | |
| if __name__ == "__main__": | |
| mcp.run() | |