get_movie_show_by_id
Retrieve detailed information about a specific movie or TV show using its MyShows ID, including episode lists and season counts for comprehensive viewing management.
Instructions
Retrieves a show or movie by its MyShows ID. :param myshows_item_id: The MyShows ID of the show or movie to retrieve. :return: A dictionary containing the show's details, including episodes and season counts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| myshows_item_id | Yes |
Implementation Reference
- src/myshows_mcp/server.py:53-60 (handler)The primary handler function for the 'get_movie_show_by_id' MCP tool. Registered via the @mcp.tool() decorator and wrapped with @tool_handler for error handling. Delegates execution to the MyShowsAPI.get_by_id method.@mcp.tool() @tool_handler async def get_movie_show_by_id(myshows_item_id: int): """Retrieves a show or movie by its MyShows ID. :param myshows_item_id: The MyShows ID of the show or movie to retrieve. :return: A dictionary containing the show's details, including episodes and season counts. """ return await api_client.get_by_id(myshows_item_id=myshows_item_id)
- src/myshows_mcp/server.py:13-28 (helper)Decorator applied to all tool handlers, including 'get_movie_show_by_id'. It checks if the API client is configured and wraps the function call in try-except for error handling.def tool_handler( func: Callable[..., Coroutine[Any, Any, Any]] ) -> Callable[..., Coroutine[Any, Any, Any]]: """A decorator to handle boilerplate for all MCP tools.""" @functools.wraps(func) async def wrapper(*args: Any, **kwargs: Any): if not api_client: return {"error": "API client is not configured. Please check server logs."} try: # The wrapped function will use the global api_client return await func(*args, **kwargs) except Exception as e: return {"error": str(e)} return wrapper
- The MyShowsAPI method invoked by the tool handler to fetch detailed information about a movie or show by its MyShows item ID via the underlying JSON-RPC API.async def get_by_id(self, myshows_item_id: int): """Retrieves a show by its MyShows ID, including episodes and season counts. :param myshows_item_id: The MyShows ID of the show to retrieve. :return: A dictionary containing the show's details, including episodes and season counts. """ return await self._make_request( method="shows.GetById", id=87, params={ "showId": int(myshows_item_id), "withEpisodes": True, "withSeasonCounts": True, }, )
- src/myshows_mcp/server.py:53-53 (registration)The @mcp.tool() decorator registers the get_movie_show_by_id function as an MCP tool.@mcp.tool()