trim-video
Trim videos to a specific duration by specifying start and end times with a video URL. This tool helps extract precise sections from videos for focused content.
Instructions
Trim videos to a specific duration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endTimestamp | Yes | End time in HH:MM:SS | |
| startTimestamp | Yes | Start time in HH:MM:SS | |
| videoUrl | Yes | URL of the video |
Implementation Reference
- src/index.ts:630-650 (handler)Executes the trim-video tool by proxying a POST request to the external NWS API endpoint with video URL, start and end timestamps, authenticating with DUMPLING_API_KEY, and returning the JSON response.async ({ videoUrl, startTimestamp, endTimestamp }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch(`${NWS_API_BASE}/api/v1/trim-video`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ videoUrl, startTimestamp, endTimestamp, requestSource: "mcp", }), }); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
- src/index.ts:625-629 (schema)Zod schema defining the input parameters for the trim-video tool: videoUrl (URL string), startTimestamp and endTimestamp (strings in HH:MM:SS format).{ videoUrl: z.string().url().describe("URL of the video"), startTimestamp: z.string().describe("Start time in HH:MM:SS"), endTimestamp: z.string().describe("End time in HH:MM:SS"), },
- src/index.ts:622-651 (registration)Registers the trim-video tool on the MCP server using server.tool, including name, description, input schema, and inline handler function.server.tool( "trim-video", "Trim videos to a specific duration.", { videoUrl: z.string().url().describe("URL of the video"), startTimestamp: z.string().describe("Start time in HH:MM:SS"), endTimestamp: z.string().describe("End time in HH:MM:SS"), }, async ({ videoUrl, startTimestamp, endTimestamp }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch(`${NWS_API_BASE}/api/v1/trim-video`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ videoUrl, startTimestamp, endTimestamp, requestSource: "mcp", }), }); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );