Skip to main content
Glama
nanameru

Gemini 2.5 Flash Image MCP

by nanameru

style_transfer

Apply artistic styles from one image to another using Google's Gemini 2.5 Flash Image technology, with optional prompt guidance for customized results.

Instructions

Transfer style from a style image to a base image, guided by an optional prompt.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseImageYes
promptNoOptional additional instruction for the style transfer.
saveToFilePathNoOptional path to save the output
styleImageYes

Implementation Reference

  • Handler function that performs style transfer by calling Gemini API with base and style images, optionally saves the result, and returns image content.
    async (args) => {
      const { prompt = 'Apply the style of the second image to the first image while preserving the original content', baseImage, styleImage, saveToFilePath } = args as { prompt?: string; baseImage: InlineImageInput; styleImage: InlineImageInput; saveToFilePath?: string };
      const results = await callGeminiGenerate({ prompt, images: [baseImage, styleImage] });
      const first = results[0];
      const savedPath = await maybeSaveImage(first.imageBase64, first.mimeType, saveToFilePath);
      const dataUrl = `data:${first.mimeType};base64,${first.imageBase64}`;
      return {
        content: [
          { type: 'text', text: `Style transferred image${savedPath ? ` saved to ${savedPath}` : ''}` },
          { type: 'image', mimeType: first.mimeType, data: first.imageBase64 },
          { type: 'text', text: dataUrl },
        ],
      };
    }
  • Input schema using Zod for style_transfer tool parameters: optional prompt, baseImage and styleImage (each with dataBase64, path, mimeType), and optional saveToFilePath.
    {
      prompt: z.string().optional().describe('Optional additional instruction for the style transfer.'),
      baseImage: z.object({
        dataBase64: z.string().optional(),
        path: z.string().optional(),
        mimeType: z.string().optional(),
      }),
      styleImage: z.object({
        dataBase64: z.string().optional(),
        path: z.string().optional(),
        mimeType: z.string().optional(),
      }),
      saveToFilePath: z.string().optional().describe('Optional path to save the output'),
    },
  • src/index.ts:215-247 (registration)
    mcp.tool registration for 'style_transfer', including description, input schema, and inline handler function.
    // Tool: style_transfer (apply style image to base image)
    mcp.tool(
      'style_transfer',
      'Transfer style from a style image to a base image, guided by an optional prompt.',
      {
        prompt: z.string().optional().describe('Optional additional instruction for the style transfer.'),
        baseImage: z.object({
          dataBase64: z.string().optional(),
          path: z.string().optional(),
          mimeType: z.string().optional(),
        }),
        styleImage: z.object({
          dataBase64: z.string().optional(),
          path: z.string().optional(),
          mimeType: z.string().optional(),
        }),
        saveToFilePath: z.string().optional().describe('Optional path to save the output'),
      },
      async (args) => {
        const { prompt = 'Apply the style of the second image to the first image while preserving the original content', baseImage, styleImage, saveToFilePath } = args as { prompt?: string; baseImage: InlineImageInput; styleImage: InlineImageInput; saveToFilePath?: string };
        const results = await callGeminiGenerate({ prompt, images: [baseImage, styleImage] });
        const first = results[0];
        const savedPath = await maybeSaveImage(first.imageBase64, first.mimeType, saveToFilePath);
        const dataUrl = `data:${first.mimeType};base64,${first.imageBase64}`;
        return {
          content: [
            { type: 'text', text: `Style transferred image${savedPath ? ` saved to ${savedPath}` : ''}` },
            { type: 'image', mimeType: first.mimeType, data: first.imageBase64 },
            { type: 'text', text: dataUrl },
          ],
        };
      }
    );

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states that style is transferred, but omits important details such as potential image size/resolution constraints, output format, and whether the operation is deterministic or requires significant computation. This is insufficient for an AI agent to anticipate side effects.

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, well-structured sentence that efficiently conveys the core function. Every word contributes to understanding, with no unnecessary elaboration.

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?

Despite moderate complexity (4 parameters, nested images, no output schema), the description fails to provide adequate context. It does not specify the output format (e.g., generated image returned inline or saved to path), behavior when prompt is omitted, or any error conditions. This leaves significant gaps for an AI agent.

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 coverage is 50% (prompt and saveToFilePath have descriptions; baseImage and styleImage do not). The tool description adds no additional parameter meaning beyond the schema—it merely restates 'optional prompt'. Given the presence of nested image objects without detailed parameter descriptions, the description should have clarified expected image formats or requirements.

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

Purpose5/5

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

The description uses a specific verb ('transfer') and clearly identifies the resources ('style image', 'base image'), making the tool's function unambiguous. It also distinguishes this tool from siblings like 'compose_images' or 'edit_image' by explicitly mentioning style transfer.

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

Usage Guidelines3/5

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

The description implies the tool should be used for style transfer tasks, but it does not provide explicit guidance on when to use this tool versus alternatives (e.g., compose_images, edit_image). No usage restrictions or prerequisites are mentioned.

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