From cc2b9ec8b66f56c418799856175f17afc59af9f2 Mon Sep 17 00:00:00 2001 From: seszele64 Date: Tue, 22 Jul 2025 19:13:13 +0200 Subject: [PATCH] feat(video): add start and end time params for trimming --- src/index.mts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/index.mts b/src/index.mts index 6dbe2c6..1fa8c30 100644 --- a/src/index.mts +++ b/src/index.mts @@ -128,11 +128,19 @@ server.setRequestHandler(ListToolsRequestSchema, async () => { type: "object", properties: { url: { type: "string", description: "URL of the video" }, - resolution: { - type: "string", + resolution: { + type: "string", description: "Preferred video resolution. For YouTube: '480p', '720p', '1080p', 'best'. For other platforms: '480p' for low quality, '720p'/'1080p' for HD, 'best' for highest quality. Defaults to '720p'", enum: ["480p", "720p", "1080p", "best"] }, + startTime: { + type: "string", + description: "Start time for trimming (format: HH:MM:SS[.ms]) - e.g., '00:01:30' or '00:01:30.500'" + }, + endTime: { + type: "string", + description: "End time for trimming (format: HH:MM:SS[.ms]) - e.g., '00:02:45' or '00:02:45.500'" + }, }, required: ["url"], }, @@ -197,10 +205,12 @@ server.setRequestHandler( CallToolRequestSchema, async (request: CallToolRequest) => { const toolName = request.params.name; - const args = request.params.arguments as { + const args = request.params.arguments as { url: string; language?: string; resolution?: string; + startTime?: string; + endTime?: string; }; if (toolName === "list_subtitle_languages") { @@ -215,7 +225,13 @@ server.setRequestHandler( ); } else if (toolName === "download_video") { return handleToolExecution( - () => downloadVideo(args.url, CONFIG, args.resolution as "480p" | "720p" | "1080p" | "best"), + () => downloadVideo( + args.url, + CONFIG, + args.resolution as "480p" | "720p" | "1080p" | "best", + args.startTime, + args.endTime + ), "Error downloading video" ); } else if (toolName === "download_audio") {