Skip to main content
Glama

add_watermark

Add a watermark image to videos with customizable position and opacity settings using FFmpeg video processing.

Instructions

Add a watermark to a video

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputPathYesPath to the input video file
watermarkPathYesPath to the watermark image
outputPathYesPath for the output video file
positionNoPosition of watermark (topleft, topright, bottomleft, bottomright, center)
opacityNoOpacity of watermark (0.0-1.0)

Implementation Reference

  • Main execution logic for add_watermark tool: validates inputs, computes overlay position, constructs FFmpeg command with filter_complex for translucent overlay, executes via runFFmpegCommand, and returns result.
    case "add_watermark": {
      const inputPath = validatePath(String(args?.inputPath), true);
      const watermarkPath = validatePath(String(args?.watermarkPath), true);
      const outputPath = validatePath(String(args?.outputPath));
      const position = String(args?.position || "bottomright");
      const opacity = Number(args?.opacity || 0.5);
      
      await ensureDirectoryExists(outputPath);
      
      // Determine overlay position
      let overlayPosition = "";
      switch (position.toLowerCase()) {
        case "topleft":
          overlayPosition = "10:10";
          break;
        case "topright":
          overlayPosition = "W-w-10:10";
          break;
        case "bottomleft":
          overlayPosition = "10:H-h-10";
          break;
        case "center":
          overlayPosition = "(W-w)/2:(H-h)/2";
          break;
        case "bottomright":
        default:
          overlayPosition = "W-w-10:H-h-10";
          break;
      }
      
      // Improved command with better handling of watermark opacity and format
      const command = `-i "${inputPath}" -i "${watermarkPath}" -filter_complex "[1:v]format=rgba,colorchannelmixer=aa=${opacity}[watermark];[0:v][watermark]overlay=${overlayPosition}:format=auto,format=yuv420p" -codec:a copy "${outputPath}" -y`;
      const result = await runFFmpegCommand(command);
      
      return {
        content: [{
          type: "text",
          text: `Watermark added: ${inputPath} → ${outputPath}\n\n${result}`
        }]
      };
    }
  • JSON schema defining inputs for add_watermark tool, including required paths and optional position/opacity.
    {
      name: "add_watermark",
      description: "Add a watermark to a video",
      inputSchema: {
        type: "object",
        properties: {
          inputPath: {
            type: "string",
            description: "Path to the input video file"
          },
          watermarkPath: {
            type: "string",
            description: "Path to the watermark image"
          },
          outputPath: {
            type: "string",
            description: "Path for the output video file"
          },
          position: {
            type: "string",
            description: "Position of watermark (topleft, topright, bottomleft, bottomright, center)"
          },
          opacity: {
            type: "number",
            description: "Opacity of watermark (0.0-1.0)"
          }
        },
        required: ["inputPath", "watermarkPath", "outputPath"]
      }
    },
  • src/index.ts:46-50 (registration)
    MCP server registration for listing tools; returns toolDefinitions array which includes the add_watermark tool schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: toolDefinitions
      };
    });
  • src/index.ts:56-68 (registration)
    MCP server registration for tool calls; dispatches to handleToolCall which routes 'add_watermark' to its specific case handler.
    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}`
          }]
        };
      }
    });
Behavior2/5

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

No annotations are provided, so the description carries full burden. 'Add a watermark to a video' implies a mutation operation that creates a new output file, but it doesn't disclose behavioral aspects like whether it overwrites existing files, requires specific permissions, handles errors, or has performance considerations. For a tool with 5 parameters and no annotations, this is a significant gap.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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?

For a mutation tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns, how it handles errors, or the implications of creating a new video file. More context is needed given the complexity and lack of structured data.

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

Parameters3/5

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

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain watermark format constraints or position defaults). Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('add a watermark') and the resource ('to a video'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'convert_video' or 'create_video_from_images', but the specific watermarking function is distinct enough to avoid confusion.

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. With siblings like 'convert_video' that might also handle watermarks, there's no indication of prerequisites, typical use cases, or when other tools might be more appropriate.

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

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