simplify_video_transcript
Transform YouTube video transcripts into simplified, age-appropriate versions for better understanding, with customizable output formats and optional key term definitions.
Instructions
Create age-appropriate simplified versions of video transcripts (ELI5 mode)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeDefinitions | No | Include definitions for key terms | |
| outputFormat | No | Preferred output format | paragraph |
| targetAge | No | Target age for simplification | |
| videoId | Yes | YouTube video ID to simplify |
Implementation Reference
- src/tools/eli5-simplifier.ts:21-84 (handler)Main handler function 'execute' that implements the core logic of the 'simplify_video_transcript' tool. Parses input args using the schema, handles caching, fetches transcript, simplifies content using LLM, computes readability scores, and returns the simplified transcript.async execute(args: unknown): Promise<SimplifiedTranscript> { const params = SimplifyVideoTranscriptSchema.parse(args); this.logger.info(`Simplifying transcript for video ${params.videoId} (target age: ${params.targetAge})`); // Generate cache key const cacheKey = `eli5:${params.videoId}:${params.targetAge}:${params.outputFormat}:${params.includeDefinitions}`; // Check cache first const cached = await this.cache.get<SimplifiedTranscript>(cacheKey); if (cached) { this.logger.info(`Returning cached ELI5 transcript for: ${params.videoId}`); return cached; } try { // Step 1: Get video details with transcript const videoDetails = await this.youtubeClient.getVideoDetails({ videoId: params.videoId, includeTranscript: true, includeComments: false }); if (!videoDetails.transcript || videoDetails.transcript.length === 0) { throw new Error(`No transcript available for video ${params.videoId}`); } // Step 2: Process and prepare transcript const processedTranscript = this.transcriptProcessor.processTranscript(videoDetails.transcript); // Step 3: Simplify using LLM const simplifiedContent = await this.simplifyTranscript( processedTranscript.fullText, videoDetails.video, params ); // Step 4: Calculate readability improvement const readabilityScores = this.calculateReadabilityScores( processedTranscript.fullText, simplifiedContent.content.sections.map(s => s.content).join(' ') ); const result: SimplifiedTranscript = { videoId: params.videoId, originalLength: processedTranscript.fullText.length, simplifiedLength: simplifiedContent.content.sections.map(s => s.content).join(' ').length, targetAge: params.targetAge, content: simplifiedContent.content, readabilityScore: readabilityScores }; // Cache the result await this.cache.set(cacheKey, result, 7200); // 2 hours cache this.logger.info(`ELI5 simplification completed for ${params.videoId}. Readability improved by ${readabilityScores.improvement}%`); return result; } catch (error) { this.logger.error(`Failed to simplify transcript for ${params.videoId}:`, error); throw error; } }
- src/types.ts:255-260 (schema)Zod schema defining input validation for the simplify_video_transcript tool, including videoId, targetAge, outputFormat, and includeDefinitions.export const SimplifyVideoTranscriptSchema = z.object({ videoId: z.string().describe('YouTube video ID'), targetAge: z.number().min(5).max(18).default(12).describe('Target age for simplification'), includeDefinitions: z.boolean().default(true).describe('Include definitions for complex terms'), outputFormat: z.enum(['paragraph', 'bullet_points', 'qa']).default('paragraph').describe('Output format'), });
- src/index.ts:443-473 (registration)Tool registration in the MCP server's listTools response, defining name, description, and inputSchema for 'simplify_video_transcript'.name: 'simplify_video_transcript', description: 'Create age-appropriate simplified versions of video transcripts (ELI5 mode)', inputSchema: { type: 'object', properties: { videoId: { type: 'string', description: 'YouTube video ID to simplify' }, targetAge: { type: 'number', minimum: 5, maximum: 18, default: 12, description: 'Target age for simplification' }, outputFormat: { type: 'string', enum: ['paragraph', 'bullet_points', 'qa'], default: 'paragraph', description: 'Preferred output format' }, includeDefinitions: { type: 'boolean', default: true, description: 'Include definitions for key terms' } }, required: ['videoId'] } },
- src/index.ts:588-590 (registration)Switch case in CallToolRequest handler that dispatches calls to 'simplify_video_transcript' to the ELI5Simplifier instance's execute method.case 'simplify_video_transcript': result = await this.eli5Tool.execute(args); break;
- src/index.ts:180-180 (registration)Instantiation of the ELI5Simplifier handler instance used for the simplify_video_transcript tool.this.eli5Tool = new ELI5Simplifier(this.youtubeClient, this.cache, this.llmService, this.transcriptProcessor, this.logger);