Skip to main content
Glama
djbriane
by djbriane

recent_movies

Retrieve recently added movies from your Plex library to stay updated on new content. Specify the number of movies to display for quick access to your latest additions.

Instructions

Get recently added movies from the Plex library.

Parameters: count: The maximum number of recent movies to return.

Returns: A formatted string of recent movies or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo

Implementation Reference

  • The core handler function for the 'recent_movies' tool, decorated with @mcp.tool(). It fetches the most recently added movies from the Plex library using the Plex API, limits them by count, formats them using format_movie helper, and returns a formatted string or error message.
    @mcp.tool()
    async def recent_movies(count: int = 5) -> str:
        """
        Get recently added movies from the Plex library.
        
        Parameters:
            count: The maximum number of recent movies to return.
            
        Returns:
            A formatted string of recent movies or an error message.
        """
        if count <= 0:
            return "ERROR: Count must be a positive integer."
        
        try:
            plex = await get_plex_server()
        except Exception as e:
            return f"ERROR: Could not connect to Plex server. {str(e)}"
    
        try:
            # Perform a global search for recently added movies
            all_recent = await asyncio.to_thread(lambda: plex.library.search(libtype="movie", sort="addedAt:desc"))
            recent_movies_list = all_recent[:count]
    
            if not recent_movies_list:
                return "No recent movies found in your Plex library."
    
            formatted_movies = []
            for i, movie in enumerate(recent_movies_list, 1):
                formatted_movies.append(
                    f"Recent Movie #{i}:\nKey: {movie.ratingKey}\nAdded: {movie.addedAt.strftime('%Y-%m-%d')}\n{format_movie(movie)}"
                )
            return "\n---\n".join(formatted_movies)
        except Exception as e:
            logger.exception("Failed to fetch recent movies")
            return f"ERROR: Failed to fetch recent movies. {str(e)}"
  • Imports the recent_movies function (and others) from plex_mcp.py into the package __init__, making it available for import as part of the plex_mcp module.
    from .plex_mcp import (
        search_movies,
        get_movie_details,
        list_playlists,
        get_playlist_items,
        create_playlist,
        delete_playlist,
        add_to_playlist,
        recent_movies,
        get_movie_genres,
        get_plex_server,
        MovieSearchParams,
    )
  • Explicitly lists 'recent_movies' in __all__, ensuring it is exported when using 'from plex_mcp import *'.
    __all__ = [
        "search_movies",
        "get_movie_details",
        "list_playlists",
        "get_playlist_items",
        "create_playlist",
        "delete_playlist",
        "add_to_playlist",
        "recent_movies",
        "get_movie_genres",
        "get_plex_server",
        "MovieSearchParams",
    ]
Behavior2/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 mentions the return format ('A formatted string of recent movies or an error message'), which adds some value, but fails to cover critical aspects like whether this is a read-only operation, potential rate limits, authentication needs, or error conditions beyond a generic mention. For a tool with zero annotation coverage, this is insufficient.

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 well-structured with clear sections for purpose, parameters, and returns, using minimal sentences that each serve a purpose. It could be slightly more front-loaded by integrating parameter details into the main description, but overall it's efficient and easy to scan.

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 low complexity (one parameter, no output schema, no annotations), the description is adequate but has gaps. It covers the basic purpose and parameter semantics, but lacks usage guidelines and full behavioral transparency (e.g., no mention of read-only nature or error handling details), making it minimally viable but not fully complete.

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 for the single parameter 'count' by explaining it as 'The maximum number of recent movies to return', which clarifies its role beyond the schema's basic type and default. Since schema description coverage is 0% and there's only one parameter, this compensation is effective, though not exhaustive (e.g., no range or constraints mentioned).

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 with a specific verb ('Get') and resource ('recently added movies from the Plex library'), making it easy to understand what it does. However, it doesn't explicitly differentiate itself from sibling tools like 'search_movies' or 'get_movie_details', which prevents a perfect score.

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 like 'search_movies' or 'get_movie_details'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage based on the purpose alone.

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/djbriane/plex-mcp'

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