Skip to main content
Glama

add_movie_by_id

Add a movie to Radarr by providing its TMDb ID. Optionally specify the root folder for the movie storage.

Instructions

Add a specific movie to Radarr using its TMDb ID.

Args: tmdb_id: The Movie Database ID for the movie root_folder: Optional root folder path (e.g., "/storage/movies")

Returns: Result of the add operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tmdb_idYes
root_folderNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYes
messageYes
media_idNo

Implementation Reference

  • The tool handler function 'add_movie_by_id' decorated with @mcp.tool. Accepts tmdb_id (int) and optional root_folder, then delegates to api.add_movie_to_radarr().
    async def add_movie_by_id(tmdb_id: int, root_folder: str | None = None) -> AddMediaResponse:
        """
        Add a specific movie to Radarr using its TMDb ID.
        
        Args:
            tmdb_id: The Movie Database ID for the movie
            root_folder: Optional root folder path (e.g., "/storage/movies")
        
        Returns:
            Result of the add operation
        """
        if not config:
            raise ValueError("Server not configured. Please set up Radarr API key.")
        
        # Use TMDb ID as title placeholder - Radarr will fetch the real title
        title = f"Movie (TMDb ID: {tmdb_id})"
    
        async with MediaServerAPI(config) as api:
            return await api.add_movie_to_radarr(tmdb_id, title, root_folder)
  • AddMediaResponse schema (BaseModel) used as the return type of add_movie_by_id, with success, message, and optional media_id fields.
    class AddMediaResponse(BaseModel):
        success: bool
        message: str
        media_id: int | None = None
  • Tool registration via the @mcp.tool decorator on line 366, which registers 'add_movie_by_id' with FastMCP.
    @mcp.tool
  • The helper method 'add_movie_to_radarr' on MediaServerAPI class that builds the Radarr API payload, handles root folder logic (parameter > config > auto-detect), posts to Radarr, and returns AddMediaResponse.
    async def add_movie_to_radarr(
        self,
        tmdb_id: int,
        title: str,
        root_folder: str | None = None,
    ) -> AddMediaResponse:
        """Add movie to Radarr"""
        url = f"{self.config.radarr_url}/api/v3/movie"
        headers = {"X-Api-Key": self.config.radarr_api_key}
    
        # Use provided title - Radarr will fetch additional details
        if not title:
            title = f"Movie (TMDb ID: {tmdb_id})"
    
        payload = {
            "title": title,
            "tmdbId": tmdb_id,
            "qualityProfileId": self.config.quality_profile_id,
            "monitored": True,
            "minimumAvailability": "announced",
            "addOptions": {
                "searchForMovie": True
            }
        }
    
        # Set root folder (parameter > config > auto-detect)
        if root_folder:
            payload["rootFolderPath"] = root_folder
            logger.info(f"Using specified root folder: {root_folder}")
        elif self.config.radarr_root_folder:
            payload["rootFolderPath"] = self.config.radarr_root_folder
            logger.info(f"Using configured root folder: {self.config.radarr_root_folder}")
        else:
            # Auto-detect first available root folder
            root_folders = await self.get_radarr_root_folders()
            if root_folders:
                payload["rootFolderPath"] = root_folders[0]["path"]
                logger.info(f"Using auto-detected Radarr root folder: {root_folders[0]['path']}")
            else:
                logger.warning("No Radarr root folders found - movie may fail to add")
    
        try:
            response = await self.client.post(url, json=payload, headers=headers)
            if response.status_code == 201:
                result = response.json()
                return AddMediaResponse(
                    success=True,
                    message=f"Successfully added '{title}' to Radarr",
                    media_id=result.get("id")
                )
            else:
                return AddMediaResponse(
                    success=False,
                    message=f"Failed to add movie: {response.text}"
                )
        except Exception as e:
            logger.error(f"Radarr API error: {e}")
            return AddMediaResponse(
                success=False,
                message=f"Error communicating with Radarr: {str(e)}"
            )
  • Helper method 'get_radarr_root_folders' used internally by add_movie_to_radarr for auto-detecting the Radarr root folder when none is explicitly provided.
    async def get_radarr_root_folders(self) -> list[dict[str, Any]]:
        """Get available root folders from Radarr"""
        url = f"{self.config.radarr_url}/api/v3/rootfolder"
        headers = {"X-Api-Key": self.config.radarr_api_key}
    
        try:
            response = await self.client.get(url, headers=headers)
            response.raise_for_status()
            return response.json()
        except Exception as e:
            logger.error(f"Failed to get Radarr root folders: {e}")
            return []
Behavior2/5

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

No annotations provided. Description lacks details on behavior: what happens on duplicates, required permissions, side effects. Only mentions return is 'Result of the add operation'.

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?

Short, uses clear Args/Returns structure, no wasted words. Could be slightly more concise but efficient overall.

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?

Has output schema (not shown). Description covers basic purpose and parameters but lacks info on error handling, duplicate behavior, or validation. Adequate for simple operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage 0%, description adds minimal meaning: tmdb_id is 'The Movie Database ID', root_folder is 'Optional root folder path' with example. No extra constraints or format details.

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

Purpose5/5

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

Description clearly states the verb 'Add', resource 'movie', method 'using its TMDb ID'. Differentiates from siblings like add_show_by_tvdb_id which handles TV shows.

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

Usage Guidelines3/5

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

Implied usage when you have a TMDb ID, but no explicit context on when not to use (e.g., if movie already exists) or comparison with siblings like search_movies.

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/omniwaifu/arr-assistant-mcp'

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