Skip to main content
Glama

scale_video

Resize video dimensions to specified width and height using FFmpeg-MCP Server. Input video path, target dimensions, and output path to generate resized video.

Instructions

视频缩放

参数:
width(int) - 目标宽度。
height(int) - 目标高度。
output_path(str) - 输出路径

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
heightYes
output_pathNo
video_pathYes
widthYes

Implementation Reference

  • MCP tool handler for 'scale_video', decorated with @mcp.tool(), delegates to the core implementation in cut_video.scale_video
    @mcp.tool()   
    def scale_video(video_path, width, height,output_path: str = None):
        """
        视频缩放
    
        参数:
        width(int) - 目标宽度。
        height(int) - 目标高度。
        output_path(str) - 输出路径
        """ 
        return cut_video.scale_video(video_path, width, height, output_path)
  • Core implementation of video scaling using FFmpeg's scale filter, handling output path, command construction, execution, and error handling.
    def scale_video(video_path, width, height = -2,output_path: str = None):
        """
        视频缩放
    
        参数:
        width(int) - 目标宽度, 如果是-2,代表保持宽高比,且是2的倍数。
        height(int) - 目标高度,如果是-2,代表保持宽高比,且是2的倍数。
        output_path(str) - 输出路径
        """
        try:
            base, ext = os.path.splitext(video_path)
            if (output_path == None):
                if (ext == None or len(ext) == 0):
                    ext = ".mp4"
                output_path = f"{base}_clip{ext}"
        
            cmd = f" -i {video_path} -filter_complex \"scale={width}:{height}\""
            cmd = f"{cmd} -y {output_path}"
            print(cmd)
            status_code, log = ffmpeg.run_ffmpeg(cmd, timeout=1000)
            print(log)
            return {status_code, log, output_path}
        except Exception as e:
            print(f"剪辑失败: {str(e)}")
            return {-1, str(e), ""}
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions scaling video but doesn't describe key traits: whether it modifies the original file or creates a new one, what formats are supported, if it preserves aspect ratio or crops, error handling (e.g., for invalid paths), or performance implications. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with a title and bullet points for parameters, making it easy to scan. However, it's under-specified—the title '视频缩放' is too brief, and the parameter list lacks crucial details like 'video_path'. While structured, it could be more informative without adding bulk.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (video processing with 4 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the operation's effect (e.g., creates a new file), input/output formats, error cases, or how it differs from siblings. For a mutation tool with undocumented parameters, this provides insufficient context for reliable agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It lists three parameters (width, height, output_path) with brief explanations, but misses 'video_path' (a required parameter) and doesn't clarify data types (e.g., width/height as integers vs. strings per schema) or constraints (e.g., positive values, path formats). The added meaning is minimal and incomplete for the 4 parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states '视频缩放' (video scaling) which indicates the tool resizes video, providing a basic verb+resource. However, it's vague about the exact operation (e.g., resizing to specific dimensions vs. scaling by percentage) and doesn't distinguish it from sibling tools like 'overlay_video' or 'clip_video' that might also manipulate video dimensions. The purpose is clear but lacks specificity and differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an input video file), exclusions (e.g., not for cropping or overlaying), or comparisons to siblings like 'clip_video' (which might resize by trimming) or 'overlay_video' (which might involve resizing in composition). Usage is implied by the parameters but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/video-creator/ffmpeg-mcp'

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