Skip to main content
Glama

add_show_by_tvdb_id

Add a TV show to Sonarr by providing its TVDB ID, title, and optional root folder.

Instructions

Add a specific TV show to Sonarr using its TVDB ID.

Args: tvdb_id: The TV Database ID for the show title: The title of the show root_folder: Optional root folder path (e.g., "/storage/anime")

Returns: Result of the add operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tvdb_idYes
titleYes
root_folderNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYes
messageYes
media_idNo

Implementation Reference

  • The MCP tool handler function that adds a TV show to Sonarr by TVDB ID. Decorated with @mcp.tool, it delegates to MediaServerAPI.add_series_to_sonarr().
    async def add_show_by_tvdb_id(tvdb_id: int, title: str, root_folder: str | None = None) -> AddMediaResponse:
        """
        Add a specific TV show to Sonarr using its TVDB ID.
        
        Args:
            tvdb_id: The TV Database ID for the show
            title: The title of the show
            root_folder: Optional root folder path (e.g., "/storage/anime")
        
        Returns:
            Result of the add operation
        """
        if not config:
            raise ValueError("Server not configured. Please set up Sonarr API key.")
        
        async with MediaServerAPI(config) as api:
            return await api.add_series_to_sonarr(tvdb_id, title, root_folder)
  • The MediaServerAPI.add_series_to_sonarr() method that actually calls the Sonarr API v3/series endpoint to add the series. Handles payload construction (TVDB ID, title, quality profile, root folder selection via parameter > config > auto-detection), the POST request, and error handling.
    async def add_series_to_sonarr(
        self,
        tvdb_id: int,
        title: str,
        root_folder: str | None = None,
    ) -> AddMediaResponse:
        """Add TV series to Sonarr using TVDB ID"""
        url = f"{self.config.sonarr_url}/api/v3/series"
        headers = {"X-Api-Key": self.config.sonarr_api_key}
    
        payload = {
            "title": title,
            "tvdbId": tvdb_id,
            "qualityProfileId": self.config.quality_profile_id,
            "monitored": True,
            "seasonFolder": True,
            "addOptions": {
                "searchForMissingEpisodes": 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.sonarr_root_folder:
            payload["rootFolderPath"] = self.config.sonarr_root_folder
            logger.info(f"Using configured root folder: {self.config.sonarr_root_folder}")
        else:
            # Auto-detect first available root folder
            root_folders = await self.get_sonarr_root_folders()
            if root_folders:
                payload["rootFolderPath"] = root_folders[0]["path"]
                logger.info(f"Using auto-detected Sonarr root folder: {root_folders[0]['path']}")
            else:
                logger.warning("No Sonarr root folders found - series 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 Sonarr",
                    media_id=result.get("id")
                )
            else:
                return AddMediaResponse(
                    success=False,
                    message=f"Failed to add series: {response.text}"
                )
        except Exception as e:
            logger.error(f"Sonarr API error: {e}")
            return AddMediaResponse(
                success=False,
                message=f"Error communicating with Sonarr: {str(e)}"
            )
  • The AddMediaResponse Pydantic model used as the return type for the tool.
    class AddMediaResponse(BaseModel):
        success: bool
        message: str
        media_id: int | None = None
  • The @mcp.tool decorator that registers add_show_by_tvdb_id as an MCP tool on the FastMCP server instance.
    @mcp.tool
    async def add_show_by_tvdb_id(tvdb_id: int, title: str, root_folder: str | None = None) -> AddMediaResponse:
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it adds a show but does not disclose side effects, permissions, duplicate handling, or error scenarios. The return is vaguely described as 'Result of the add operation' despite an output schema existing. More behavioral context is needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured with Args and Returns sections. Every sentence is informative without redundancy. It is appropriately sized for the tool's complexity.

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 presence of an output schema (though not shown), the description need not detail return values. However, it lacks context about prerequisites (e.g., Sonarr configuration, authentication) and error conditions. It is adequate but not fully complete for a tool with no annotations.

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?

With schema description coverage at 0%, the description adds significant meaning: explains 'tvdb_id' as 'The TV Database ID', 'title' as 'The title of the show', and 'root_folder' as 'Optional root folder path' with an example. This compensates for the schema's lack of descriptions.

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?

The description clearly states 'Add a specific TV show to Sonarr using its TVDB ID,' specifying the verb 'add', the resource 'TV show', and the method 'using TVDB ID'. It distinguishes itself from siblings like 'add_movie_by_id' and 'search_and_add_show' by focusing on direct addition via TVDB ID.

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?

The description implies usage when a TVDB ID is available, but does not explicitly state when not to use this tool or mention alternatives like 'search_and_add_show' for cases where the ID is unknown. No direct guidance on prerequisites or exclusions.

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