File size: 3,875 Bytes
d822f93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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),
    ]
}

@mcp.tool()
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()