get_seat_map
View available and reserved seating arrangements for AMC movie showtimes to help select seats for booking.
Instructions
Displays available and reserved seats for a specific showtime.
Args: showtime_id: Showtime ID (e.g., "st001")
Returns: JSON string with seat availability map
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| showtime_id | Yes |
Implementation Reference
- src/amc_mcp/server.py:338-383 (handler)Primary handler implementation for the get_seat_map tool. Retrieves seat availability for a showtime, checks against existing bookings, builds seat map, and returns formatted JSON response.async def _get_seat_map(self, args: Dict[str, Any]) -> CallToolResult: """Get seat map for a showtime""" showtime_id = args.get("showtime_id") if not showtime_id or showtime_id not in self.showtimes: return CallToolResult( content=[TextContent(type="text", text=json.dumps({"error": "Invalid showtime ID"}))] ) # Get seats for this showtime (mock data) seats = self.seats_data.get(showtime_id, []) seat_map = [] for seat_data in seats: # Check if seat is already booked is_booked = any( seat_data["seat_number"] in booking.seats and booking.status == "confirmed" for booking in self.bookings.values() if booking.showtime_id == showtime_id ) seat_map.append({ "seat_number": seat_data["seat_number"], "row": seat_data["row"], "column": seat_data["column"], "is_available": not is_booked, "price_tier": seat_data["price_tier"], "price": seat_data.get("price", 15.00) }) showtime = self.showtimes[showtime_id] theater = self.theaters.get(showtime.theater_id) movie = self.movies.get(showtime.movie_id) result = { "showtime_id": showtime_id, "movie": movie.title if movie else "Unknown", "theater": theater.name if theater else "Unknown Theater", "date": showtime.date, "time": showtime.time, "seat_map": seat_map } return CallToolResult( content=[TextContent(type="text", text=json.dumps(result, indent=2))] )
- src/amc_mcp/fastmcp_server.py:270-309 (handler)Alternative handler implementation (FastMCP version) for get_seat_map tool with identical core logic to the main server.def _get_seat_map(showtime_id: str) -> str: """Internal implementation of get_seat_map""" if not showtime_id or showtime_id not in showtimes: return json.dumps({"error": "Invalid showtime ID"}) # Get seats for this showtime seats = seats_data.get(showtime_id, []) seat_map = [] for seat_data in seats: # Check if seat is already booked is_booked = any( seat_data["seat_number"] in booking.seats and booking.status == "confirmed" for booking in bookings.values() if booking.showtime_id == showtime_id ) seat_map.append({ "seat_number": seat_data["seat_number"], "row": seat_data["row"], "column": seat_data["column"], "is_available": not is_booked, "price_tier": seat_data["price_tier"], "price": seat_data.get("price", 15.00) }) showtime = showtimes[showtime_id] theater = theaters.get(showtime.theater_id) movie = movies.get(showtime.movie_id) result = { "showtime_id": showtime_id, "movie": movie.title if movie else "Unknown", "theater": theater.name if theater else "Unknown Theater", "date": showtime.date, "time": showtime.time, "seat_map": seat_map } return json.dumps(result, indent=2)
- src/amc_mcp/server.py:160-170 (schema)Input schema definition for get_seat_map tool registered in list_tools handler.Tool( name="get_seat_map", description="Displays available and reserved seats for a specific showtime", inputSchema={ "type": "object", "properties": { "showtime_id": {"type": "string", "description": "Showtime ID"} }, "required": ["showtime_id"] } ),
- src/amc_mcp/fastmcp_server.py:312-323 (registration)Tool registration using FastMCP @mcp.tool() decorator, which delegates to internal _get_seat_map handler.@mcp.tool() def get_seat_map(showtime_id: str) -> str: """ Displays available and reserved seats for a specific showtime. Args: showtime_id: Showtime ID (e.g., "st001") Returns: JSON string with seat availability map """ return _get_seat_map(showtime_id)
- src/amc_mcp/server.py:210-211 (registration)Dispatch/registration logic in call_tool handler that routes get_seat_map requests to the _get_seat_map implementation.elif request.name == "get_seat_map": return await self._get_seat_map(request.arguments)