Skip to main content
Glama

playlists_getPlaylist

Retrieve detailed information about a YouTube playlist, including its metadata and content, by providing the playlist ID through the YouTube MCP Server.

Instructions

Get information about a YouTube playlist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playlistIdYesThe YouTube playlist ID

Implementation Reference

  • The core handler function that executes the playlists_getPlaylist tool logic by calling the YouTube API to retrieve playlist details.
    async getPlaylist({ 
      playlistId 
    }: PlaylistParams): Promise<any> {
      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)}`);
      }
    }
  • src/server.ts:222-229 (registration)
    Registers the tool handler in the MCP server's CallToolRequestHandler switch statement, delegating to PlaylistService.getPlaylist.
    case 'playlists_getPlaylist': {
        const result = await playlistService.getPlaylist(args as unknown as PlaylistParams);
        return {
            content: [{
                type: 'text',
                text: JSON.stringify(result, null, 2)
            }]
        };
  • Defines the tool schema (name, description, inputSchema) returned by ListToolsRequestHandler.
    {
        name: 'playlists_getPlaylist',
        description: 'Get information about a YouTube playlist',
        inputSchema: {
            type: 'object',
            properties: {
                playlistId: {
                    type: 'string',
                    description: 'The YouTube playlist ID',
                },
            },
            required: ['playlistId'],
        },
    },
  • TypeScript interface for the input parameters used in the tool handler and cast in the registration.
    export interface PlaylistParams {
      playlistId: string;
    }
Install Server

Other Tools

Related 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/ZubeidHendricks/youtube-mcp-server'

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