Skip to main content
Glama

transcripts_getTranscript

Extract video transcripts from YouTube to analyze spoken content, enable accessibility, or create text-based resources from video material.

Instructions

Get the transcript of a YouTube video

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
videoIdYesThe YouTube video ID
languageNoLanguage code for the transcript

Implementation Reference

  • Core handler function that fetches the YouTube video transcript using the YoutubeTranscript library and formats the response.
    async getTranscript({ videoId, language = process.env.YOUTUBE_TRANSCRIPT_LANG || 'en' }: TranscriptParams): Promise<unknown> { try { this.initialize(); // YoutubeTranscript.fetchTranscript only accepts videoId const transcript = await YoutubeTranscript.fetchTranscript(videoId); return { videoId, language, transcript }; } catch (error) { throw new Error(`Failed to get transcript: ${error instanceof Error ? error.message : String(error)}`); } }
  • TypeScript interface defining the input parameters for the transcript tool (videoId required, language optional).
    export interface TranscriptParams { videoId: string; language?: string; }
  • Registers the 'transcripts_getTranscript' tool with Zod input schema and a thin handler that delegates to TranscriptService.
    'transcripts_getTranscript', { title: 'Get Video Transcript', description: 'Get the transcript of a YouTube video', annotations: { readOnlyHint: true, idempotentHint: true }, inputSchema: { videoId: z.string().describe('The YouTube video ID'), language: z.string().optional().describe('Language code for the transcript'), }, }, async ({ videoId, language }) => { const result = await transcriptService.getTranscript({ videoId, language }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } );

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/sfiorini/youtube-mcp'

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