search_movies
Search for movie titles using the Radarr lookup feature. Provides results in a structured format to help users find and manage films efficiently.
Instructions
Search for movies by title using Radarr's built-in lookup.
Args: title: Movie title only (e.g., "The Matrix" or "Primer")
Returns: Dict with search results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes |
Implementation Reference
- src/arr_assistant_mcp/main.py:291-349 (handler)The handler function for the 'search_movies' tool. It is decorated with @mcp.tool, which registers it as an MCP tool. The function performs the core logic: checks configuration, instantiates MediaServerAPI, calls search_radarr_movies on Radarr, formats results using MediaSearchResult, and returns a dictionary of results.@mcp.tool async def search_movies(title: str) -> Dict[str, Any]: """ Search for movies by title using Radarr's built-in lookup. Args: title: Movie title only (e.g., "The Matrix" or "Primer") Returns: Dict with search results """ logger.info(f"Searching for movies: '{title}'") if not config: error_msg = "Server not configured. Please set up Radarr API key." logger.error(error_msg) return {"error": error_msg, "results": []} if not config.radarr_api_key: error_msg = "Radarr API key not configured" logger.error(error_msg) return {"error": error_msg, "results": []} api = MediaServerAPI(config) try: logger.info(f"Searching Radarr for: {title}") radarr_results = await api.search_radarr_movies(title) logger.info(f"Radarr returned {len(radarr_results)} results") if not radarr_results: return { "message": f"No movies found matching '{title}'", "results": [], "searched_query": title } results = [] for movie in radarr_results[:10]: # Show more results since we're not auto-adding result = MediaSearchResult( title=movie.get("title", "Unknown"), year=movie.get("year"), overview=movie.get("overview", "No overview available"), tmdb_id=movie.get("tmdbId"), poster_path=movie.get("remotePoster"), media_type="movie" ) results.append(result) return { "results": [r.dict() for r in results], "total_found": len(results), "searched_query": title } except Exception as e: error_msg = f"Error during movie search: {str(e)}" logger.error(error_msg, exc_info=True) return {"error": error_msg, "results": []}