youtube-video-summarizer-mcp
Version:
An MCP server for YouTube video summarization
39 lines • 1.41 kB
JavaScript
import { z } from "zod";
import { getYouTubeVideoInfo } from "../handlers/get-video-info.handler.js";
const toolName = "summarize-video";
const toolDescription = "Get video information and captions in a format optimized for summarization";
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) => {
// Get video information and transcript using youtube-caption-extractor
const response = await getYouTubeVideoInfo(args.videoUrl);
if (response.isError) {
return {
content: [
{
type: "text",
text: `Error getting video info: ${response.error}`,
},
],
};
}
const videoInfo = response.result;
// Format the response in a way that's easy for Claude to summarize
return {
content: [
{
type: "text",
text: `Title: ${videoInfo?.title}\n\nDescription: ${videoInfo?.description}\n\nSubtitles: ${videoInfo?.subtitles}`,
},
],
};
};
export const SummarizeVideoTool = {
name: toolName,
description: toolDescription,
schema: toolSchema,
handler: toolHandler,
};
//# sourceMappingURL=summarize-video.tool.js.map