Skip to main content
Glama
maoxiaoke

MCP Media Processing Server

by maoxiaoke

apply-effect

Transform images by applying effects like blur, sharpen, grayscale, or sepia using customizable intensity. Save processed files to a specified path or default Downloads folder.

Instructions

Apply visual effect to image

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
effectYesEffect to apply
inputPathYesAbsolute path to input image file
intensityNoEffect intensity (0-100, not applicable for some effects)
outputFilenameNoOutput filename (only used if outputPath is not provided)
outputPathNoOptional absolute path for output file. If not provided, file will be saved in Downloads folder

Implementation Reference

  • src/index.ts:513-579 (registration)
    Registration of the 'apply-effect' MCP tool using server.tool, including inline schema and handler function.
    server.tool(
      "apply-effect",
      "Apply visual effect to image",
      {
        inputPath: z.string().describe("Absolute path to input image file"),
        effect: z.enum(['blur', 'sharpen', 'edge', 'emboss', 'grayscale', 'sepia', 'negate']).describe("Effect to apply"),
        intensity: z.number().min(0).max(100).default(50).describe("Effect intensity (0-100, not applicable for some effects)"),
        outputPath: z.string().optional().describe("Optional absolute path for output file. If not provided, file will be saved in Downloads folder"),
        outputFilename: z.string().optional().describe("Output filename (only used if outputPath is not provided)")
      },
      async ({ inputPath, effect, intensity, outputPath, outputFilename }) => {
        try {
          await checkImageMagick();
          const absoluteInputPath = await getAbsolutePath(inputPath);
          const inputFileName = absoluteInputPath.split('/').pop()?.split('.')[0] || 'output';
          const extension = absoluteInputPath.split('.').pop() || 'png';
          const defaultFilename = outputFilename || `${inputFileName}_${effect}.${extension}`;
          const finalOutputPath = await getOutputPath(outputPath, defaultFilename);
    
          let command = '';
          switch (effect) {
            case 'blur':
              command = `convert "${absoluteInputPath}" -blur 0x${intensity / 5} "${finalOutputPath}"`;
              break;
            case 'sharpen':
              command = `convert "${absoluteInputPath}" -sharpen 0x${intensity / 10} "${finalOutputPath}"`;
              break;
            case 'edge':
              command = `convert "${absoluteInputPath}" -edge ${intensity / 10} "${finalOutputPath}"`;
              break;
            case 'emboss':
              command = `convert "${absoluteInputPath}" -emboss ${intensity / 10} "${finalOutputPath}"`;
              break;
            case 'grayscale':
              command = `convert "${absoluteInputPath}" -colorspace Gray "${finalOutputPath}"`;
              break;
            case 'sepia':
              command = `convert "${absoluteInputPath}" -sepia-tone ${intensity}% "${finalOutputPath}"`;
              break;
            case 'negate':
              command = `convert "${absoluteInputPath}" -negate "${finalOutputPath}"`;
              break;
          }
    
          await execSync(command);
    
          return {
            content: [
              {
                type: "text",
                text: `Effect successfully applied and saved to: ${finalOutputPath}`,
              },
            ],
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          return {
            content: [
              {
                type: "text",
                text: `Error applying effect: ${errorMessage}`,
              },
            ],
          };
        }
      }
    );
  • Handler that applies ImageMagick effects to images based on the 'effect' parameter (blur, sharpen, edge, emboss, grayscale, sepia, negate), handling paths and errors.
    async ({ inputPath, effect, intensity, outputPath, outputFilename }) => {
      try {
        await checkImageMagick();
        const absoluteInputPath = await getAbsolutePath(inputPath);
        const inputFileName = absoluteInputPath.split('/').pop()?.split('.')[0] || 'output';
        const extension = absoluteInputPath.split('.').pop() || 'png';
        const defaultFilename = outputFilename || `${inputFileName}_${effect}.${extension}`;
        const finalOutputPath = await getOutputPath(outputPath, defaultFilename);
    
        let command = '';
        switch (effect) {
          case 'blur':
            command = `convert "${absoluteInputPath}" -blur 0x${intensity / 5} "${finalOutputPath}"`;
            break;
          case 'sharpen':
            command = `convert "${absoluteInputPath}" -sharpen 0x${intensity / 10} "${finalOutputPath}"`;
            break;
          case 'edge':
            command = `convert "${absoluteInputPath}" -edge ${intensity / 10} "${finalOutputPath}"`;
            break;
          case 'emboss':
            command = `convert "${absoluteInputPath}" -emboss ${intensity / 10} "${finalOutputPath}"`;
            break;
          case 'grayscale':
            command = `convert "${absoluteInputPath}" -colorspace Gray "${finalOutputPath}"`;
            break;
          case 'sepia':
            command = `convert "${absoluteInputPath}" -sepia-tone ${intensity}% "${finalOutputPath}"`;
            break;
          case 'negate':
            command = `convert "${absoluteInputPath}" -negate "${finalOutputPath}"`;
            break;
        }
    
        await execSync(command);
    
        return {
          content: [
            {
              type: "text",
              text: `Effect successfully applied and saved to: ${finalOutputPath}`,
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error applying effect: ${errorMessage}`,
            },
          ],
        };
      }
    }
  • Zod input schema for the apply-effect tool parameters.
    {
      inputPath: z.string().describe("Absolute path to input image file"),
      effect: z.enum(['blur', 'sharpen', 'edge', 'emboss', 'grayscale', 'sepia', 'negate']).describe("Effect to apply"),
      intensity: z.number().min(0).max(100).default(50).describe("Effect intensity (0-100, not applicable for some effects)"),
      outputPath: z.string().optional().describe("Optional absolute path for output file. If not provided, file will be saved in Downloads folder"),
      outputFilename: z.string().optional().describe("Output filename (only used if outputPath is not provided)")
    },
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral information. It states the action ('apply visual effect') but doesn't disclose whether this modifies the original file or creates a new one, what happens if output parameters aren't provided, whether there are file format limitations, or what happens on failure. The description doesn't contradict annotations (since none exist), but provides inadequate behavioral context for a mutation tool.

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 extremely concise at just 5 words, front-loading the core purpose with zero wasted words. Every element earns its place, making it easy to parse while conveying the essential function.

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 insufficiently complete. It doesn't address what the tool returns (success/failure indicators, output location confirmation), doesn't explain behavioral aspects like file handling, and provides no context about limitations or prerequisites despite the tool performing a potentially complex image transformation.

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?

With 100% schema description coverage, the baseline is 3. The description doesn't add any parameter semantics beyond what's already documented in the schema - it doesn't explain what the effects do, how intensity interacts with different effects, or provide guidance on parameter combinations. The schema already documents all parameters thoroughly.

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 ('apply') and target ('visual effect to image'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'convert-image' or 'resize-image' which also modify images, leaving some ambiguity about when to choose this specific tool.

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 multiple sibling tools that also process images (convert-image, resize-image, add-watermark, etc.), there's no indication of when visual effects are appropriate versus other image transformations or which effects might be preferred for specific use cases.

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/maoxiaoke/mcp-media-processor'

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