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
| Name | Required | Description | Default |
|---|---|---|---|
| playlistId | Yes | The YouTube playlist ID |
Implementation Reference
- src/services/playlist.ts:37-52 (handler)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) }] };
- src/server.ts:131-144 (schema)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'], }, },
- src/types.ts:69-71 (schema)TypeScript interface for the input parameters used in the tool handler and cast in the registration.export interface PlaylistParams { playlistId: string; }