Skip to main content
Glama

getTranscripts

Retrieve video transcripts from YouTube, focusing on key segments like intro hooks and final calls to action, or get full text for analysis.

Instructions

Retrieves specific, meaningful segments of a video's transcript. By default, it returns the intro 'hook' and the final 'outro' or call to action. It can also return the full transcript text. Use this to efficiently analyze a video's key messaging.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoThe desired transcript format. 'full_text': Returns the entire transcript as a single string. 'key_segments': (Default) Returns only the video's intro hook and final call to action.key_segments
langNoLanguage code for transcripts (e.g., 'en', 'ko', 'es'). Defaults to environment setting or 'en'en
videoIdsYesArray of YouTube video IDs to get transcripts for

Implementation Reference

  • Main execution logic for the getTranscripts tool: validates input, fetches transcript segments for multiple videos using TranscriptService, formats results.
    export const getTranscriptsHandler = async ( params: TranscriptsParams, transcriptService: TranscriptService ): Promise<CallToolResult> => { try { const validatedParams = getTranscriptsSchema.parse(params); const { videoIds, lang, format } = validatedParams; const transcriptPromises = videoIds.map((videoId) => transcriptService.getTranscriptSegments(videoId, lang, format) ); const transcripts = await Promise.all(transcriptPromises); const result = formatVideoMap(videoIds, transcripts); return formatSuccess(result); } catch (error: unknown) { return formatError(error); } };
  • Zod input schema defining videoIds (array), lang (language code, default 'en'), format ('full_text' or 'key_segments', default 'key_segments').
    export const getTranscriptsSchema = z.object({ videoIds: z .array(videoIdSchema) .describe("Array of YouTube video IDs to get transcripts for"), lang: languageSchema .default("en") .describe( "Language code for transcripts (e.g., 'en', 'ko', 'es'). Defaults to environment setting or 'en'" ), format: z .enum(["full_text", "key_segments"]) .default("key_segments") .describe( "The desired transcript format. " + "'full_text': Returns the entire transcript as a single string. " + "'key_segments': (Default) Returns only the video's intro hook and final call to action." ), });
  • Tool registration in allTools(): associates getTranscriptsConfig with a wrapped handler injecting transcriptService dependency.
    { config: getTranscriptsConfig, handler: (params) => getTranscriptsHandler( params as unknown as TranscriptsParams, transcriptService ), },
  • Tool configuration object defining name, description, and inputSchema for MCP tool registration.
    export const getTranscriptsConfig = { name: "getTranscripts", description: "Retrieves specific, meaningful segments of a video's transcript. By default, it returns the intro 'hook' and the final 'outro' or call to action. It can also return the full transcript text. Use this to efficiently analyze a video's key messaging.", inputSchema: getTranscriptsSchema, };

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

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