Skip to main content
Glama
hi5d
by hi5d

get_showtimes

Find available movie showtimes by specifying a movie ID, date, and location to retrieve schedule information for AMC Theatres.

Instructions

Fetches available showtimes for a specific movie and location.

Args: movie_id: Movie ID (e.g., "mv001") date: Date in YYYY-MM-DD format (e.g., "2025-10-28") location: City, state or ZIP code

Returns: JSON string with available showtimes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
movie_idYes
dateYes
locationYes

Implementation Reference

  • Core handler logic for the get_showtimes tool in FastMCP implementation, filters showtimes by movie_id and date from global mock data.
    def _get_showtimes(movie_id: str, date: str, location: str) -> str:
        """Internal implementation of get_showtimes"""
        if not movie_id or movie_id not in movies:
            return json.dumps({"error": "Invalid movie ID"})
        
        movie = movies[movie_id]
        showtime_list = []
        
        for showtime in showtimes.values():
            if showtime.movie_id == movie_id and showtime.date == date:
                theater = theaters.get(showtime.theater_id)
                if theater:
                    showtime_list.append({
                        "showtime_id": showtime.showtime_id,
                        "theater_name": theater.name,
                        "theater_address": theater.address,
                        "time": showtime.time,
                        "format": showtime.format,
                        "price": showtime.price
                    })
        
        result = {
            "movie": {"id": movie.movie_id, "title": movie.title},
            "date": date,
            "location": location,
            "showtimes": showtime_list
        }
        
        return json.dumps(result, indent=2)
  • FastMCP tool decorator registration for get_showtimes, including docstring parameters and delegation to internal handler.
    def get_showtimes(movie_id: str, date: str, location: str) -> str:
        """
        Fetches available showtimes for a specific movie and location.
        
        Args:
            movie_id: Movie ID (e.g., "mv001")
            date: Date in YYYY-MM-DD format (e.g., "2025-10-28")
            location: City, state or ZIP code
        
        Returns:
            JSON string with available showtimes
        """
        return _get_showtimes(movie_id, date, location)
  • Input schema and metadata for get_showtimes tool defined in the list_tools handler.
    Tool(
        name="get_showtimes",
        description="Fetches available showtimes for a specific movie and location",
        inputSchema={
            "type": "object",
            "properties": {
                "movie_id": {"type": "string", "description": "Movie ID"},
                "date": {"type": "string", "description": "Date in YYYY-MM-DD format"},
                "location": {"type": "string", "description": "City, state or ZIP code"}
            },
            "required": ["movie_id", "date", "location"]
        }
    ),
  • Async handler method for executing get_showtimes tool in standard MCP server implementation, similar logic to FastMCP version.
    async def _get_showtimes(self, args: Dict[str, Any]) -> CallToolResult:
        """Get showtimes for a movie on a specific date and location"""
        movie_id = args.get("movie_id")
        date = args.get("date")
        location = args.get("location")
        
        if not movie_id or movie_id not in self.movies:
            return CallToolResult(
                content=[TextContent(type="text", text=json.dumps({"error": "Invalid movie ID"}))]
            )
        
        movie = self.movies[movie_id]
        showtimes = []
        
        for showtime in self.showtimes.values():
            if showtime.movie_id == movie_id and showtime.date == date:
                theater = self.theaters.get(showtime.theater_id)
                if theater:
                    showtimes.append({
                        "showtime_id": showtime.showtime_id,
                        "theater_name": theater.name,
                        "theater_address": theater.address,
                        "time": showtime.time,
                        "format": showtime.format,
                        "price": showtime.price
                    })
        
        result = {
            "movie": {"id": movie.movie_id, "title": movie.title},
            "date": date,
            "location": location,
            "showtimes": showtimes
        }
        
        return CallToolResult(
            content=[TextContent(type="text", text=json.dumps(result, indent=2))]
        )
  • Dispatch logic in call_tool handler that routes get_showtimes requests to the specific handler method.
    elif request.name == "get_showtimes":
        return await self._get_showtimes(request.arguments)

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