get_video_info
Retrieve detailed metadata and technical specifications from a video file, including resolution, codec, duration, and bitrate, to analyze or process media content effectively.
Instructions
Get detailed information about a video file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to the video file |
Implementation Reference
- src/tools/handlers.ts:11-20 (handler)Switch case in handleToolCall function that executes the get_video_info tool by validating input and calling getVideoInfo helper.case "get_video_info": { const filePath = validatePath(String(args?.filePath), true); const info = await getVideoInfo(filePath); return { content: [{ type: "text", text: info }] }; }
- src/tools/definitions.ts:6-19 (schema)Tool definition including name, description, and input schema (filePath: string) for get_video_info.{ name: "get_video_info", description: "Get detailed information about a video file", inputSchema: { type: "object", properties: { filePath: { type: "string", description: "Path to the video file" } }, required: ["filePath"] } },
- src/index.ts:46-50 (registration)Registers the list of available tools via ListToolsRequestHandler, exposing get_video_info schema from toolDefinitions.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions }; });
- src/index.ts:56-68 (registration)Registers the CallToolRequestHandler which dispatches tool calls to handleToolCall based on name, handling get_video_info.server.setRequestHandler(CallToolRequestSchema, async (request) => { try { return await handleToolCall(request.params.name, request.params.arguments); } catch (error: any) { console.error("Tool execution error:", error.message); return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } });
- src/utils/ffmpeg.ts:27-40 (helper)Implementation of getVideoInfo using ffprobe to fetch JSON-formatted video file information.export async function getVideoInfo(filePath: string): Promise<string> { try { validatePath(filePath, true); console.log(`Getting video info for: ${filePath}`); const { stdout, stderr } = await execPromise(`ffprobe -v error -show_format -show_streams -print_format json "${filePath}"`); return stdout || stderr; } catch (error: any) { console.error("FFprobe error:", error.message); if (error.stderr) { return error.stderr; } throw new Error(`FFprobe error: ${error.message}`); } }