Skip to main content
Glama
hi5d
by hi5d

get_recommendations

Get personalized movie suggestions based on your preferred genre, current mood, or time of day to find films that match your viewing preferences.

Instructions

Suggests movies based on mood, genre, or time preferences.

Args: genre: Movie genre (optional, e.g., "action", "comedy") mood: Mood description (optional, e.g., "exciting", "romantic") time_preference: Time of day preference (optional, e.g., "evening")

Returns: JSON string with movie recommendations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
genreNo
moodNo
time_preferenceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Primary handler for the get_recommendations tool in the standard MCP server implementation. Filters movies from mock data based on genre and mood, returns top 5 recommendations as JSON.
    async def _get_recommendations(self, args: Dict[str, Any]) -> CallToolResult:
        """Get movie recommendations based on preferences"""
        genre = args.get("genre", "").lower()
        mood = args.get("mood", "").lower()
        
        recommendations = []
        for movie in self.movies.values():
            # Simple matching logic
            if genre and genre in movie.genre.lower():
                recommendations.append({
                    "movie_id": movie.movie_id,
                    "title": movie.title,
                    "genre": movie.genre,
                    "description": movie.description,
                    "rating": movie.rating
                })
            elif mood and (mood in movie.description.lower() or mood in movie.genre.lower()):
                recommendations.append({
                    "movie_id": movie.movie_id,
                    "title": movie.title,
                    "genre": movie.genre,
                    "description": movie.description,
                    "rating": movie.rating
                })
        
        if not recommendations and not genre and not mood:
            # Return top picks if no specific criteria
            recommendations = [
                {
                    "movie_id": movie.movie_id,
                    "title": movie.title,
                    "genre": movie.genre,
                    "description": movie.description,
                    "rating": movie.rating
                }
                for movie in list(self.movies.values())[:5]
            ]
        
        result = {
            "criteria": {"genre": genre, "mood": mood},
            "recommendations": recommendations[:5]
        }
        
        return CallToolResult(
            content=[TextContent(type="text", text=json.dumps(result, indent=2))]
        )
  • Tool registration in list_tools() handler, defining the name, description, and input schema for get_recommendations.
    Tool(
        name="get_recommendations",
        description="Suggests movies based on mood, genre, or time preferences",
        inputSchema={
            "type": "object",
            "properties": {
                "genre": {"type": "string", "description": "Movie genre (optional)"},
                "mood": {"type": "string", "description": "Mood description (optional)"},
                "time_preference": {"type": "string", "description": "Time of day preference (optional)"}
            }
        }
    ),
  • Handler function for get_recommendations in FastMCP implementation, registered via @mcp.tool() decorator, calls internal _get_recommendations.
    def get_recommendations(
        genre: Optional[str] = None,
        mood: Optional[str] = None,
        time_preference: Optional[str] = None
    ) -> str:
        """
        Suggests movies based on mood, genre, or time preferences.
        
        Args:
            genre: Movie genre (optional, e.g., "action", "comedy")
            mood: Mood description (optional, e.g., "exciting", "romantic")
            time_preference: Time of day preference (optional, e.g., "evening")
        
        Returns:
            JSON string with movie recommendations
        """
        return _get_recommendations(genre, mood, time_preference)
  • Supporting helper function implementing the recommendation logic for the FastMCP get_recommendations tool.
    def _get_recommendations(
        genre: Optional[str] = None,
        mood: Optional[str] = None,
        time_preference: Optional[str] = None
    ) -> str:
        """Get movie recommendations based on preferences"""
        recommendations = []
        
        genre_lower = genre.lower() if genre else ""
        mood_lower = mood.lower() if mood else ""
        
        for movie in movies.values():
            if genre_lower and genre_lower in movie.genre.lower():
                recommendations.append({
                    "movie_id": movie.movie_id,
                    "title": movie.title,
                    "genre": movie.genre,
                    "description": movie.description,
                    "rating": movie.rating
                })
            elif mood_lower and (mood_lower in movie.description.lower() or mood_lower in movie.genre.lower()):
                recommendations.append({
                    "movie_id": movie.movie_id,
                    "title": movie.title,
                    "genre": movie.genre,
                    "description": movie.description,
                    "rating": movie.rating
                })
        
        if not recommendations and not genre and not mood:
            # Return top picks if no specific criteria
            recommendations = [
                {
                    "movie_id": movie.movie_id,
                    "title": movie.title,
                    "genre": movie.genre,
                    "description": movie.description,
                    "rating": movie.rating
                }
                for movie in list(movies.values())[:5]
            ]
        
        result = {
            "criteria": {"genre": genre, "mood": mood, "time_preference": time_preference},
            "recommendations": recommendations[:5]
        }
        
        return json.dumps(result, indent=2)
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool 'suggests movies' and returns 'JSON string with movie recommendations', which implies a read-only operation. However, it lacks details on behavioral traits like rate limits, error handling, or whether the suggestions are personalized or generic. The description doesn't contradict annotations (none provided).

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 appropriately sized and front-loaded: the first sentence states the purpose, followed by a structured 'Args' and 'Returns' section. Every sentence adds value, with no redundant information. It could be slightly more concise by integrating the parameter explanations into the opening sentence.

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's moderate complexity (3 optional parameters) and the presence of an output schema (which covers return values), the description is somewhat complete. It explains the tool's purpose and parameters but lacks usage guidelines and behavioral context. With no annotations, it should do more to compensate, such as mentioning if it's a read-only operation or any limitations.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining each parameter's purpose with examples (e.g., 'genre: Movie genre (optional, e.g., "action", "comedy")'). This clarifies semantics beyond the schema's basic type definitions. However, it doesn't cover constraints like valid values or interactions between parameters.

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's purpose: 'Suggests movies based on mood, genre, or time preferences.' This specifies the verb ('suggests'), resource ('movies'), and filtering criteria. However, it doesn't explicitly differentiate from sibling tools like 'get_now_showing' or 'get_showtimes', which might also return movie information.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_now_showing' or 'get_showtimes', which could be relevant for movie-related queries. There's no context about prerequisites, such as whether user authentication is needed.

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/hi5d/amc-mcp'

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