get_playlist_transcripts
Extract transcripts from all videos in a YouTube playlist, supporting multiple languages and output formats like text, JSON, or SRT. Includes optional metadata for enhanced analysis.
Instructions
Extract transcripts from all videos in a YouTube playlist
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeMetadata | No | Include metadata in response | |
| language | No | Language code (e.g., "en", "es", "fr") | en |
| outputFormat | No | Output format | json |
| playlistId | Yes | YouTube playlist ID or URL |
Implementation Reference
- The primary handler function implementing the getPlaylistTranscripts tool logic. It extracts the playlist ID and currently throws an error, noting that full implementation requires a YouTube Data API key to fetch video IDs from the playlist.public async getPlaylistTranscripts( request: PlaylistTranscriptRequest ): Promise<BulkTranscriptResponse> { try { // Extract playlist ID const playlistId = this.extractPlaylistId(request.playlistId); // Get video IDs from playlist (this would need YouTube Data API) // For now, we'll throw an error indicating this needs API key throw new Error('Playlist processing requires YouTube Data API key. Please extract video IDs manually.'); } catch (error) { this.logger.error(`Failed to process playlist ${request.playlistId}:`, error); return { results: [], errors: [{ videoId: request.playlistId, error: error instanceof Error ? error.message : 'Unknown error' }], summary: { total: 0, successful: 0, failed: 1 } }; } }
- src/types/index.ts:40-45 (schema)TypeScript interface defining the input schema for the get_playlist_transcripts tool.export interface PlaylistTranscriptRequest { playlistId: string; outputFormat: 'text' | 'json' | 'srt'; language?: string; includeMetadata?: boolean; }
- src/server/mcp-server.ts:149-177 (registration)Registration of the 'get_playlist_transcripts' tool in the MCP server's list of available tools, including its description and input schema.name: 'get_playlist_transcripts', description: 'Extract transcripts from all videos in a YouTube playlist', inputSchema: { type: 'object', properties: { playlistId: { type: 'string', description: 'YouTube playlist ID or URL' }, language: { type: 'string', description: 'Language code (e.g., "en", "es", "fr")', default: 'en' }, outputFormat: { type: 'string', enum: ['text', 'json', 'srt'], description: 'Output format', default: 'json' }, includeMetadata: { type: 'boolean', description: 'Include metadata in response', default: true } }, required: ['playlistId'] } },
- src/server/mcp-server.ts:280-302 (handler)MCP server wrapper handler that parses arguments, validates input, calls the transcript service, and formats the response for the MCP protocol.private async handleGetPlaylistTranscripts(args: any) { const { playlistId, language = 'en', outputFormat = 'json', includeMetadata = true } = args; if (!playlistId) { throw new McpError(ErrorCode.InvalidParams, 'playlistId is required'); } const request = { playlistId, language, outputFormat, includeMetadata }; const result = await this.transcriptService.getPlaylistTranscripts(request); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }