get_video_info
Extract technical details from video files, including format, duration, resolution, and codec information, to analyze media properties.
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)Handler logic for 'get_video_info' tool: validates the filePath argument and delegates to getVideoInfo helper function, returning the info as text content.case "get_video_info": { const filePath = validatePath(String(args?.filePath), true); const info = await getVideoInfo(filePath); return { content: [{ type: "text", text: info }] }; }
- src/utils/ffmpeg.ts:27-40 (helper)Core implementation: uses ffprobe to extract detailed video information (format and streams) in JSON format, with path validation and error handling.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}`); } }
- src/tools/definitions.ts:6-19 (schema)Tool schema definition: specifies name, description, and input schema requiring a 'filePath' string.{ 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 all tools including 'get_video_info' by exposing toolDefinitions in the ListToolsRequest handler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions }; });
- src/index.ts:56-68 (registration)Registers the CallToolRequest handler which dispatches to handleToolCall based on tool name, enabling execution of '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}` }] }; } });