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 },
          ],
        };
      }
    );

Tool Definition Quality

Score is being calculated. Check back soon.

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