Skip to main content
Glama
hi5d
by hi5d

get_seat_map

View available and reserved seats for a specific AMC showtime to select your preferred seating before 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
NameRequiredDescriptionDefault
showtime_idYes

Implementation Reference

  • Handler function that implements the get_seat_map tool logic: validates showtime_id, loads seat data, checks availability against existing bookings, constructs seat map, adds context from showtime/theater/movie, returns JSON in CallToolResult.
    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))]
        )
  • Core internal implementation of get_seat_map: identical logic to server.py version, validates showtime, builds seat map with availability, returns JSON string.
    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)
  • MCP tool registration for get_seat_map, defining name, description, and input schema requiring 'showtime_id'.
    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"]
        }
    ),
  • FastMCP tool registration and thin handler for get_seat_map using @mcp.tool() decorator, with type hints and docstring providing schema info, delegates to internal _get_seat_map.
    @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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hi5d/amc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server