Skip to main content
Glama
uzaysozen

imdb-mcp-server

get_top_rated_telugu_movies

Retrieve top-rated Telugu movies from IMDb by specifying a starting index to access the ranked list.

Instructions

Top 50 rated Telugu movies on IMDb. Args: start: The starting index (0-based) to retrieve movies from. Returns: JSON object containing 5 top rated Telugu movies starting from the specified index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for get_top_rated_telugu_movies tool. It fetches top rated Telugu movies from the IMDb API endpoint and provides a paginated JSON response using helper functions.
    @mcp.tool()
    async def get_top_rated_telugu_movies(start: int, ctx: Context) -> str:
        """Top 50 rated Telugu movies on IMDb.
        Args:
            start: The starting index (0-based) to retrieve movies from.
        Returns:
            JSON object containing 5 top rated Telugu movies starting from the specified index.
        """
        top_rated_telugu_movies_url = f"{BASE_URL}/india/top-rated-telugu-movies"
        top_rated_telugu_movies_data = await make_imdb_request(top_rated_telugu_movies_url, {}, ctx)
        if not top_rated_telugu_movies_data:
            return "Unable to fetch top rated Telugu movies data."
        return json.dumps(paginated_response(top_rated_telugu_movies_data, start, len(top_rated_telugu_movies_data)), indent=4)
  • Call to register_tools function which defines and registers the get_top_rated_telugu_movies tool (along with others) using the @mcp.tool() decorator.
    # Register all tools with the server
    register_tools(server)
  • Helper function make_imdb_request used by the tool to perform cached HTTP requests to the IMDb API.
    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}")
  • Helper function paginated_response used by the tool to format the paginated JSON output with fixed page size of 5.
    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
        }
  • BASE_URL constant used in the tool to construct the API endpoint URL for top rated Telugu movies.
    BASE_URL = "https://imdb236.p.rapidapi.com/api/imdb"
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool returns '5 top rated Telugu movies starting from the specified index' but doesn't explain critical behaviors like pagination (how to get beyond 5 movies), rate limits, authentication requirements, error conditions, or what happens when 'start' exceeds available movies. This leaves significant gaps for an agent to use it effectively.

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

Conciseness4/5

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

The description is efficiently structured with a clear purpose statement followed by parameter and return explanations. However, the formatting with 'Args:' and 'Returns:' sections is slightly verbose for such a simple tool, and the title repetition in 'get_top_rated_telugu_moviesArguments' in the schema is extraneous but not in the description itself.

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

Completeness3/5

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

Given the tool has an output schema (though not shown here), the description doesn't need to detail return values. However, with no annotations and a simple but potentially confusing behavior (returns 5 movies from a 'Top 50' list), the description should better explain the relationship between the 50 movies and the 5 returned, and address pagination or limits. It's minimally adequate but leaves operational questions unanswered.

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 description adds meaningful context about the 'start' parameter being '0-based' and that it retrieves '5 top rated Telugu movies starting from the specified index', which clarifies how the parameter affects the output. With 0% schema description coverage (schema only has type and title), this compensation is valuable, though it could specify valid ranges or constraints.

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

Purpose4/5

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

The description clearly states the tool retrieves 'Top 50 rated Telugu movies on IMDb' with a specific verb ('retrieve') and resource ('Telugu movies'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_top_rated_indian_movies' or 'get_trending_telugu_movies', which would require more specific scope clarification.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'get_top_rated_indian_movies' or 'get_trending_telugu_movies'. The description only explains what the tool does, not when it's appropriate compared to other movie-related tools in the server.

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