Skip to main content
Glama

Get Playlist Information

playlists_getPlaylist
Read-onlyIdempotent

Fetch metadata and contents of any YouTube playlist by providing its unique playlist ID. Returns title, description, video items, and other playlist information.

Instructions

Get information about a YouTube playlist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlistIdYesThe YouTube playlist ID

Implementation Reference

  • The getPlaylist method in PlaylistService that fetches a YouTube playlist's snippet and contentDetails via the YouTube Data API v3.
    async getPlaylist({ 
      playlistId 
    }: PlaylistParams): Promise<unknown> {
      try {
        this.initialize();
        
        const response = await this.youtube.playlists.list({
          part: ['snippet', 'contentDetails'],
          id: [playlistId]
        });
        
        return response.data.items?.[0] || null;
      } catch (error) {
        throw new Error(`Failed to get playlist: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Registration of the 'playlists_getPlaylist' tool on the MCP server, with input schema and handler that delegates to playlistService.getPlaylist.
    server.registerTool(
        'playlists_getPlaylist',
        {
            title: 'Get Playlist Information',
            description: 'Get information about a YouTube playlist',
            annotations: { readOnlyHint: true, idempotentHint: true },
            inputSchema: {
                playlistId: z.string().describe('The YouTube playlist ID'),
            },
        },
        async ({ playlistId }) => {
            const result = await playlistService.getPlaylist({ playlistId });
            return {
                content: [{
                    type: 'text',
                    text: JSON.stringify(result, null, 2)
                }]
            };
        }
    );
  • PlaylistParams interface defining that the tool expects a 'playlistId' string as input.
    export interface PlaylistParams {
      playlistId: string;
    }
  • Initialization helper that sets up the YouTube API client with the API key from environment variables.
    private initialize() {
      if (this.initialized) return;
      
      const apiKey = process.env.YOUTUBE_API_KEY;
      if (!apiKey) {
        throw new Error('YOUTUBE_API_KEY environment variable is not set.');
      }
    
      this.youtube = google.youtube({
        version: "v3",
        auth: apiKey
      });
      
      this.initialized = true;
Behavior3/5

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

Annotations already provide readOnlyHint=true and idempotentHint=true, indicating a safe read operation. The description adds no further behavioral traits (e.g., rate limits, return structure), but does not contradict annotations.

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 a single, concise sentence that contains no redundant information, making it easy to parse and effective.

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?

For a simple tool with one parameter and safety annotations, the description is adequate but lacks details on what information the playlist includes (e.g., title, description, privacy status). Without an output schema, the agent is left guessing the return content.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'playlistId' clearly described as 'The YouTube playlist ID'. The tool description adds no additional meaning beyond the schema, meeting the baseline.

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 explicitly states 'Get information about a YouTube playlist', using a clear verb and resource. This distinguishes it from sibling playlists_getPlaylistItems which returns playlist items, making the purpose clear.

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?

No explicit guidance on when to use this tool versus alternatives. The purpose is implied, but no direction is given for choosing between playlists_getPlaylist and playlists_getPlaylistItems or other siblings.

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

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