Skip to main content
Glama
easyhak

YouTube Search & Download MCP Server

by easyhak

get_playlist_info

Retrieve detailed YouTube playlist information including title, creator, video count, and description by providing the playlist ID. Output available in JSON or markdown format.

Instructions

Get detailed information about a specific YouTube playlist.

Args: playlist_id: YouTube playlist ID (e.g., "PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf") output_format: Output format - "json" or "markdown" (default: "json")

Returns: Detailed playlist information including title, creator, video count, and description

Example: get_playlist_info("PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf", output_format="markdown")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
output_formatNojson

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `get_playlist_info` function is defined as an MCP tool using `@mcp.tool()`. It handles validation, retrieves playlist details from the search provider, formats the output, and includes error handling.
    @mcp.tool()
    async def get_playlist_info(playlist_id: str, output_format: str = "json") -> str:
        """
        Get detailed information about a specific YouTube playlist.
    
        Args:
            playlist_id: YouTube playlist ID (e.g., "PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf")
            output_format: Output format - "json" or "markdown" (default: "json")
    
        Returns:
            Detailed playlist information including title, creator, video count, and description
    
        Example:
            get_playlist_info("PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf", output_format="markdown")
        """
        try:
            logger.info(f"Get playlist info request: playlist_id='{playlist_id}'")
    
            # Basic validation
            if not playlist_id or len(playlist_id) < 10:
                raise InvalidQueryError(f"Invalid playlist ID format: {playlist_id}")
    
            # Get playlist details
            provider = get_search_provider()
            details = await provider.get_playlist_details(playlist_id)
    
            # Format results
            formatter = get_formatter(output_format)
            result = formatter.format_playlist_details(details)
    
            logger.info(f"Retrieved info for playlist: {details.title}")
            return result
    
        except InvalidQueryError as e:
            logger.warning(f"Invalid playlist ID: {e.message}")
            return json.dumps({"error": "invalid_playlist_id", "message": e.message})
        except VideoNotFoundError as e:
            logger.warning(f"Playlist not found: {e.message}")
            return json.dumps(
                {"error": "playlist_not_found", "message": "Playlist not found or unavailable."}
            )
        except NetworkError as e:
            logger.error(f"Network error: {e.message}")
            return json.dumps(
                {
                    "error": "network_error",
                    "message": "Failed to connect to YouTube.",
                    "details": e.message,
                }
            )
        except ExtractionError as e:
            logger.error(f"Extraction error: {e.message}")
            return json.dumps(
                {
                    "error": "extraction_failed",
                    "message": "Failed to extract playlist information.",
                    "details": e.message,
                }
            )
        except Exception:
            logger.exception("Unexpected error in get_playlist_info")
            return json.dumps(
                {"error": "internal_error", "message": "An unexpected error occurred."}
            )
  • The registration function that defines how playlist tools (including `get_playlist_info`) are exposed to the MCP server.
    def register_playlist_tools(mcp: FastMCP) -> None:
        """
        Register all playlist-related tools with the MCP server.
    
        Args:
            mcp: FastMCP server instance
        """
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the tool's read-only nature implicitly through 'Get' and specifies output format options, but lacks details on rate limits, authentication needs, error conditions, or pagination behavior. It adds some context but leaves significant behavioral gaps uncovered.

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 well-structured with clear sections (Args, Returns, Example) and every sentence adds value. It's front-loaded with the core purpose, followed by necessary details without redundancy. The example is concise and illustrative.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no annotations, but has output schema), the description covers the essential purpose, parameters, and return scope adequately. The output schema existence means return values don't need explanation here, but more behavioral context (e.g., error handling) would improve completeness.

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?

Schema description coverage is 0%, so the description must compensate. It clearly explains both parameters: playlist_id (with an example) and output_format (with options and default). This adds essential meaning beyond the bare schema, though it doesn't detail format-specific output structures or playlist_id validation rules.

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 the specific action ('Get detailed information') and resource ('about a specific YouTube playlist'), distinguishing it from siblings like get_playlist_videos (which lists videos) or get_video_info (which focuses on individual videos). The purpose is precise and unambiguous.

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 detailed playlist metadata is needed, but provides no explicit guidance on when to choose this over alternatives like search_playlists (for discovery) or get_playlist_videos (for video listings). It lacks explicit when/when-not statements or named alternatives for similar queries.

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/easyhak/youtube-search-mcp'

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