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 },
          ],
        };
      }
    );
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 lacks critical behavioral details. It doesn't disclose whether this is a read-only or destructive operation, what permissions are needed, rate limits, or what happens to the original images. The description mentions saving output but doesn't specify default behavior if 'saveToFilePath' is omitted.

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 front-loads the core purpose. Every word earns its place by specifying the action, inputs, and optional element without redundancy or fluff.

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 complex image processing tool with 4 parameters, nested objects, no annotations, and no output schema, the description is inadequate. It doesn't explain the output (e.g., image format, dimensions), error conditions, or practical constraints like image size limits. The lack of behavioral transparency and parameter guidance 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.

Parameters3/5

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

Schema description coverage is 50%, with only 'prompt' and 'saveToFilePath' having descriptions. The description adds minimal value by mentioning the optional prompt but doesn't explain what constitutes effective prompts or the relationship between baseImage and styleImage beyond what the schema implies. It doesn't compensate for the lack of schema descriptions for the image objects.

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 ('transfer style') and identifies the key resources ('style image' and 'base image'), with an optional prompt. It distinguishes from siblings like 'compose_images' or 'edit_image' by focusing specifically on style transfer rather than composition or editing. However, it doesn't specify the exact style transfer method or output format.

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?

No explicit guidance on when to use this tool versus alternatives like 'edit_image' or 'generate_image' is provided. The description mentions an optional prompt but doesn't explain when it's beneficial to include one. There are no prerequisites, limitations, or comparison with sibling tools mentioned.

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/nanameru/Gemini-2.5-Flash-Image-MCP'

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