list_transcripts
Retrieve all available transcripts for a YouTube video by specifying its ID or URL, ensuring accurate and accessible content extraction in multiple formats.
Instructions
List all available transcripts for a YouTube video
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| videoId | Yes | YouTube video ID or URL |
Implementation Reference
- src/server/mcp-server.ts:222-235 (registration)Registration of the 'list_transcripts' MCP tool, including name, description, and input schema definition.{ name: 'list_transcripts', description: 'List all available transcripts for a YouTube video', inputSchema: { type: 'object', properties: { videoId: { type: 'string', description: 'YouTube video ID or URL' } }, required: ['videoId'] } }
- src/server/mcp-server.ts:343-358 (handler)MCP server handler for 'list_transcripts' tool call, validates input and delegates to YouTubeTranscriptService.private async handleListTranscripts(args: any) { const { videoId } = args; if (!videoId) { throw new McpError(ErrorCode.InvalidParams, 'videoId is required'); } const result = await this.transcriptService.listTranscripts(videoId); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- Core handler implementation in YouTubeTranscriptService that executes the Python script to list available transcripts for a video.public async listTranscripts(videoId: string): Promise<{ success: boolean; videoId: string; transcripts: Array<{ language: string; language_code: string; is_generated: boolean; is_translatable: boolean; }>; error?: string; }> { try { const cleanVideoId = this.extractVideoId(videoId); const command = `python3 "${this.pythonScript}" list --video-id "${cleanVideoId}"`; const { stdout, stderr } = await execAsync(command); if (stderr) { this.logger.warn(`Python script warning: ${stderr}`); } const result: PythonListResult = JSON.parse(stdout); return result; } catch (error) { this.logger.error(`Failed to list transcripts for video ${videoId}:`, error); return { success: false, videoId: this.extractVideoId(videoId), transcripts: [], error: error instanceof Error ? error.message : 'Unknown error' }; } }
- src/server/mcp-server.ts:225-234 (schema)Input schema definition for the 'list_transcripts' tool.inputSchema: { type: 'object', properties: { videoId: { type: 'string', description: 'YouTube video ID or URL' } }, required: ['videoId'] }