Skip to main content
Glama
easyhak

YouTube Search & Download MCP Server

by easyhak

get_playlist_videos

Retrieve videos and metadata from a YouTube playlist by providing the playlist ID, with options to limit results and choose output format.

Instructions

Get list of videos from a YouTube playlist.

Args: playlist_id: YouTube playlist ID (e.g., "PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf") max_results: Maximum number of videos to return (None for all videos, default: None) output_format: Output format - "json" or "markdown" (default: "json")

Returns: List of videos in the playlist with metadata

Example: get_playlist_videos("PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf", max_results=20)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
max_resultsNo
output_formatNojson

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_playlist_videos', which validates inputs, fetches videos from the search provider, and formats the output.
    async def get_playlist_videos(
        playlist_id: str, max_results: int | None = None, output_format: str = "json"
    ) -> str:
        """
        Get list of videos from a YouTube playlist.
    
        Args:
            playlist_id: YouTube playlist ID (e.g., "PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf")
            max_results: Maximum number of videos to return (None for all videos, default: None)
            output_format: Output format - "json" or "markdown" (default: "json")
    
        Returns:
            List of videos in the playlist with metadata
    
        Example:
            get_playlist_videos("PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf", max_results=20)
        """
        try:
            logger.info(
                f"Get playlist videos request: playlist_id='{playlist_id}', max_results={max_results}"
            )
    
            # Basic validation
            if not playlist_id or len(playlist_id) < 10:
                raise InvalidQueryError(f"Invalid playlist ID format: {playlist_id}")
    
            # Get playlist videos
            provider = get_search_provider()
            videos = await provider.get_playlist_videos(playlist_id, max_results)
    
            # Format results
            formatter = get_formatter(output_format)
            result = formatter.format_videos(videos)
    
            logger.info(f"Retrieved {len(videos)} videos from playlist")
            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 videos.",
                    "details": e.message,
                }
            )
        except Exception:
            logger.exception("Unexpected error in get_playlist_videos")
            return json.dumps(
                {"error": "internal_error", "message": "An unexpected error occurred."}
            )
  • The function responsible for registering playlist tools to the FastMCP server.
    def register_playlist_tools(mcp: FastMCP) -> None:
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return format options ('json' or 'markdown') and that it returns a list with metadata, but lacks details on rate limits, authentication needs, error handling, or whether it's a read-only operation. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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?

The description is well-structured and appropriately sized, with a clear purpose statement followed by parameter details, return info, and an example. Each section adds value without redundancy. Minor improvements could include bolding key terms, but overall it's efficient and easy to scan.

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 tool has an output schema (which handles return values), the description covers the basics: purpose, parameters, and a simple example. However, with no annotations and multiple sibling tools, it lacks context on authentication, error cases, and differentiation from alternatives. It's minimally viable but has clear gaps for effective agent use.

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 effectively explains all three parameters: 'playlist_id' is clarified with an example ID format, 'max_results' specifies 'None for all videos' and a default, and 'output_format' defines the two options and default. This adds meaningful context beyond the bare schema, though it could elaborate on constraints like playlist ID validation.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get list of videos from a YouTube playlist.' It specifies the verb ('Get') and resource ('videos from a YouTube playlist'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_playlist_info' or 'get_video_info', which could cause confusion about when to use each.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_playlist_info' and 'get_video_info' available, there's no indication of whether this tool retrieves different metadata, handles pagination differently, or serves a distinct use case. The example shows basic usage but doesn't address context or prerequisites.

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