Skip to main content
Glama

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
NameRequiredDescriptionDefault
filePathYesPath to the video file

Implementation Reference

  • 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
        }]
      };
    }
  • 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}`);
      }
    }
  • 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}`
          }]
        };
      }
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sworddut/mcp-ffmpeg-helper'

If you have feedback or need assistance with the MCP directory API, please join our Discord server