Skip to main content
Glama
uzaysozen

imdb-mcp-server

get_upcoming_indian_movies

Retrieve upcoming Indian movies from IMDb based on real-time popularity data. Specify a starting index to get the next set of anticipated releases.

Instructions

Get the most anticipated Indian movies on IMDb based on real-time popularity. Args: start: The starting index (0-based) to retrieve movies from. Returns: JSON object containing 5 most anticipated Indian movies starting from the specified index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function decorated with @mcp.tool() that implements the tool logic: fetches upcoming Indian movies from the IMDb API endpoint '/india/upcoming', handles errors, and returns a paginated JSON response using helper functions.
    @mcp.tool()
    async def get_upcoming_indian_movies(start: int, ctx: Context) -> str:
        """Get the most anticipated Indian movies on IMDb based on real-time popularity.
        Args:
            start: The starting index (0-based) to retrieve movies from.
        Returns:
            JSON object containing 5 most anticipated Indian movies starting from the specified index.
        """
        upcoming_indian_movies_url = f"{BASE_URL}/india/upcoming"
        upcoming_indian_movies_data = await make_imdb_request(upcoming_indian_movies_url, {}, ctx)
        if not upcoming_indian_movies_data:
            return "Unable to fetch upcoming Indian movies data."
        return json.dumps(paginated_response(upcoming_indian_movies_data, start, len(upcoming_indian_movies_data)), indent=4)
  • Supporting utility that performs HTTP requests to the IMDb API, handles authentication with RapidAPI key from context or env, caching via cache_manager, and error handling.
    async def make_imdb_request(url: str, querystring: dict[str, Any], ctx: Optional[Context] = None) -> Optional[Dict[str, Any]]:
        """Make a request to the IMDb API with proper error handling and caching."""
        
        # Check if it's time to clean the cache
        cache_manager.cleanup_if_needed()
        
        # Create a cache key from the URL and querystring
        cache_key = f"{url}_{str(querystring)}"
        
        # Try to get from cache first
        cached_data = cache_manager.cache.get(cache_key)
        if cached_data:
            return cached_data
        
        # Get API key from session config or fallback to environment variable
        api_key = None
        if ctx and hasattr(ctx, 'session_config') and ctx.session_config:
            api_key = ctx.session_config.rapidApiKeyImdb
        
        if not api_key:
            api_key = os.getenv("RAPID_API_KEY_IMDB")
        
        # Not in cache, make the request
        headers = {
            "x-rapidapi-key": api_key,
            "x-rapidapi-host": "imdb236.p.rapidapi.com",
        }
        
        if not api_key:
            raise ValueError("API key not found. Please set the RAPID_API_KEY_IMDB environment variable or provide rapidApiKeyImdb in the request.")
        
        try:
            response = requests.get(url, headers=headers, params=querystring, timeout=30.0)
            response.raise_for_status()
            data = response.json()
            
            # Cache the response
            cache_manager.cache.set(cache_key, data)
                
            return data
        except Exception as e:
            raise ValueError(f"Unable to fetch data from IMDb. Please try again later. Error: {e}")
  • Supporting utility function used by the handler to format the response as a paginated JSON object with fixed page size of 5 items.
    def paginated_response(items, start, total_count=None):
        """Format a paginated response with a fixed page size of 5."""
        if total_count is None:
            total_count = len(items)
        
        # Validate starting index
        start = max(0, min(total_count - 1 if total_count > 0 else 0, start))
        
        # Fixed page size of 5
        page_size = 5
        end = min(start + page_size, total_count)
        
        return {
            "items": items[start:end],
            "start": start,
            "count": end - start,
            "totalCount": total_count,
            "hasMore": end < total_count,
            "nextStart": end if end < total_count else None
        }
  • The call to register_tools(server) in the server creation function, which defines and registers all MCP tools including get_upcoming_indian_movies via nested @mcp.tool() decorators.
    # Register all tools with the server
    register_tools(server)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It specifies the return format ('JSON object containing 5 most anticipated Indian movies') and hints at pagination behavior through the 'start' parameter, but doesn't mention rate limits, authentication needs, data freshness, or what happens if the start index exceeds available movies. It adds some context but leaves gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by a structured 'Args:' and 'Returns:' section. Every sentence adds value—no redundant or verbose content—making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter), no annotations, but with an output schema (which handles return values), the description is mostly complete. It covers purpose, parameter semantics, and return structure. However, it lacks details on behavioral aspects like error handling or data limitations, which would be beneficial despite the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It explains the 'start' parameter as 'The starting index (0-based) to retrieve movies from,' which clarifies its purpose and format beyond the schema's basic integer type. However, it doesn't detail constraints (e.g., valid ranges) or provide examples, leaving some ambiguity for a single parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get'), resource ('most anticipated Indian movies on IMDb'), and scope ('based on real-time popularity'). It distinguishes from siblings like 'get_top_rated_indian_movies' by focusing on upcoming/anticipated movies rather than top-rated ones, and from 'get_upcoming_releases' by specifying Indian movies and IMDb as the source.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through 'most anticipated Indian movies on IMDb based on real-time popularity,' suggesting it's for discovering upcoming popular Indian films. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_top_rated_indian_movies' or 'get_upcoming_releases,' nor does it provide exclusions or prerequisites for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/uzaysozen/imdb-mcp-server'

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