ABDALLALSWAITI commited on
Commit
d822f93
·
verified ·
1 Parent(s): 09f56b8

Upload dining_server.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. dining_server.py +84 -0
dining_server.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from mcp.server.fastmcp import FastMCP
2
+ import random
3
+ import urllib.parse
4
+
5
+ mcp = FastMCP("DiningAgent")
6
+
7
+ # Destination-specific restaurants
8
+ DESTINATION_RESTAURANTS = {
9
+ "dubai": [
10
+ ("At.mosphere", "World's highest restaurant at Burj Khalifa", "$$$$", "Fine Dining", 4.7),
11
+ ("Pierchic", "Overwater seafood restaurant at Al Qasr", "$$$$", "Seafood", 4.6),
12
+ ("Ossiano", "Underwater dining at Atlantis", "$$$$", "Seafood", 4.8),
13
+ ("Al Hadheerah", "Arabian desert dining with live entertainment", "$$$", "Arabic", 4.5),
14
+ ("Nusr-Et Steakhouse", "Salt Bae's famous steakhouse", "$$$$", "Steakhouse", 4.4),
15
+ ("Arabian Tea House", "Traditional Emirati cuisine", "$$", "Local", 4.6),
16
+ ("Ravi Restaurant", "Famous Pakistani street food", "$", "Pakistani", 4.5),
17
+ ],
18
+ "paris": [
19
+ ("Le Jules Verne", "Michelin-starred Eiffel Tower dining", "$$$$", "French", 4.5),
20
+ ("Café de Flore", "Historic Left Bank café", "$$", "French Café", 4.3),
21
+ ("L'Ambroisie", "3 Michelin star classic French", "$$$$", "Fine Dining", 4.9),
22
+ ("Pink Mamma", "Trendy Italian in Pigalle", "$$", "Italian", 4.4),
23
+ ],
24
+ "tokyo": [
25
+ ("Sukiyabashi Jiro", "Legendary 3 Michelin star sushi", "$$$$", "Sushi", 4.9),
26
+ ("Ichiran Ramen", "Famous tonkotsu ramen chain", "$", "Ramen", 4.5),
27
+ ("Gonpachi", "The Kill Bill restaurant", "$$$", "Japanese", 4.4),
28
+ ("Genki Sushi", "Fun conveyor belt sushi", "$$", "Sushi", 4.3),
29
+ ],
30
+ "default": [
31
+ ("The Local Kitchen", "Farm-to-table dining experience", "$$$", "Local", 4.5),
32
+ ("Seaside Terrace", "Fresh seafood with views", "$$$", "Seafood", 4.4),
33
+ ("Downtown Bistro", "Classic comfort food", "$$", "International", 4.3),
34
+ ("Rooftop Garden", "Panoramic views and cocktails", "$$$", "Modern", 4.6),
35
+ ]
36
+ }
37
+
38
+ @mcp.tool()
39
+ def find_restaurants(city: str, cuisine: str = "local", buffet: bool = False) -> str:
40
+ """Find restaurants or buffets in a city with reservation links."""
41
+
42
+ # URL encode city
43
+ city_clean = city.split(",")[0].strip()
44
+ city_lower = city_clean.lower()
45
+ city_encoded = urllib.parse.quote(city_clean)
46
+
47
+ # Get city-specific restaurants or default
48
+ restaurants = DESTINATION_RESTAURANTS.get(city_lower, DESTINATION_RESTAURANTS["default"])
49
+
50
+ results = []
51
+ results.append(f"🍽️ **Top Restaurants in {city}**")
52
+ results.append("")
53
+ results.append("---")
54
+
55
+ selected = random.sample(restaurants, min(4, len(restaurants)))
56
+
57
+ price_emojis = {"$": "💵", "$$": "💵💵", "$$$": "💵💵💵", "$$$$": "💵💵💵💵"}
58
+
59
+ for i, (name, desc, price, cuisine_type, base_rating) in enumerate(selected, 1):
60
+ rating = round(base_rating + random.uniform(-0.2, 0.2), 1)
61
+ rating = min(5.0, max(4.0, rating))
62
+ reviews = random.randint(500, 3000)
63
+
64
+ # Build booking URLs
65
+ restaurant_encoded = urllib.parse.quote(f"{name} {city_clean}")
66
+ tripadvisor_url = f"https://www.tripadvisor.com/Search?q={restaurant_encoded}"
67
+ opentable_url = f"https://www.opentable.com/s?term={restaurant_encoded}"
68
+
69
+ results.append("")
70
+ results.append(f"### 🍴 Option {i}: {name}")
71
+ results.append(f"{desc}")
72
+ results.append(f"🍳 {cuisine_type} | {price_emojis.get(price, '')} {price}")
73
+ results.append(f"⭐ {rating}/5 ({reviews:,} reviews)")
74
+ results.append(f"🔗 [View on TripAdvisor]({tripadvisor_url}) | [Reserve on OpenTable]({opentable_url})")
75
+ results.append("")
76
+
77
+ results.append("---")
78
+ results.append("")
79
+ results.append(f"💡 **More restaurants:** [Explore {city_clean} dining on TripAdvisor](https://www.tripadvisor.com/Search?q={city_encoded}%20restaurants)")
80
+
81
+ return "\n".join(results)
82
+
83
+ if __name__ == "__main__":
84
+ mcp.run()