UNPKG

youtube-video-summarizer-mcp

Version:

An MCP server for YouTube video summarization with Claude

48 lines 1.64 kB
import { z } from "zod"; import { getYouTubeVideoDetails } from "../handlers/get-video-captions.handler.js"; const toolName = "get-video-details"; const toolDescription = "Get the title, description, and captions of a YouTube video from URL"; const toolSchema = { videoUrl: z.string().describe("The URL or ID of the YouTube video"), language: z.string().default("en").describe("The language code for captions (default: 'en')"), }; const toolHandler = async (args, _extra) => { const response = await getYouTubeVideoDetails(args.videoUrl, args.language); if (response.isError) { return { content: [ { type: "text", text: `Error getting video captions: ${response.error}`, }, ], }; } const videoDetails = response.result; if (!videoDetails?.subtitles) { return { content: [ { type: "text", text: "No captions found for this video.", }, ], }; } const captions = videoDetails.subtitles.map((caption) => caption.text).join(" "); return { content: [ { type: "text", text: `Video Title: ${videoDetails.title}\n\n Video Description: ${videoDetails.description}\n\n Video Captions: ${captions}`, }, ], }; }; export const GetVideoCaptionsTool = { name: toolName, description: toolDescription, schema: toolSchema, handler: toolHandler, }; //# sourceMappingURL=get-video-captions.tool.js.map