Skip to main content
Glama
recraft-ai

Recraft AI MCP Server

Official

image_to_image

Transform an input image into a new image guided by a text prompt, adjusting the influence of the original image with a strength parameter.

Instructions

Generate an image using Recraft from an input image and a text prompt. You can specify the reference input image, style, model, and number of images to generate. You should provide the same style/substyle/styleID settings as were used for input image generation (if exists) if there are no specific requirements to change the style. Other parameters are recommended to keep default if you don't have any specific requirements on them. You can use styles to refine the image generation, and also to generate raster or vector images. Local paths or URLs to generated images and their previews will be returned in the response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageURIYesImage to use as an input. This can be a URL (starting with http:// or https://) or an absolute file path (starting with file://).
promptYesText prompt of the image you want to generate. Its length should be from 1 to 1024 characters.
strengthYesStrength of the image to image transformation, where 0 means almost similar to reference input image, 1 means almost no reference.
styleNoVisual style to apply. Default is realistic_image. Use this parameter only if you want to refine the image generation. Mutually exclusive with styleID, you can't specify both of them. realistic_image, digital_illustration, vector_illustration are available in both models, but icon is available only for recraftv2, and logo_raster is available only for recraftv3. If you will provide a style that is not available for the specified model, generation will fail. Styles use-cases: - realistic_image: for realistic images, photos, portraits, landscapes, etc. Raster is generated. - digital_illustration: for digital illustrations, concept art, fantasy art, etc. Raster is generated. - vector_illustration: for vector illustrations, logos, icons, etc. Vector is generated. - icon: for icons, small graphics (only in recraftv2). Vector is generated - logo_raster: for graphic design, raster logos, posters, emblems, and badges (only in recraftv3). Raster is generated. You should provide the same style/substyle/styleID settings as were used for input image generation (if they exist) if there are no specific requirements to change the style in the resulting image.
substyleNoVisual substyle to apply. Can be specified only with style to refine more specifically. If this parameter is not specified, model will decide on the final style. Use this parameter only if you want to refine the image generation more. No need to specify if you don't have any specific requirements. Note that each combination of model and style has their own list of available substyles: - recraftv3 with style realistic_image: b_and_w, enterprise, evening_light, faded_nostalgia, forest_life, hard_flash, hdr, motion_blur, mystic_naturalism, natural_light, natural_tones, organic_calm, real_life_glow, retro_realism, retro_snapshot, studio_portrait, urban_drama, village_realism, warm_folk - recraftv2 with style realistic_image: b_and_w, enterprise, hard_flash, hdr, motion_blur, natural_light, studio_portrait - recraftv3 with style digital_illustration: 2d_art_poster, 2d_art_poster_2, antiquarian, bold_fantasy, child_book, cover, crosshatch, digital_engraving, engraving_color, expressionism, freehand_details, grain, grain_20, graphic_intensity, hand_drawn, hand_drawn_outline, handmade_3d, hard_comics, infantile_sketch, long_shadow, modern_folk, multicolor, neon_calm, noir, nostalgic_pastel, outline_details, pastel_gradient, pastel_sketch, pixel_art, plastic, pop_art, pop_renaissance, seamless, street_art, tablet_sketch, urban_glow, urban_sketching, young_adult_book, young_adult_book_2 - recraftv2 with style digital_illustration: 2d_art_poster, 2d_art_poster_2, 3d, 80s, engraving_color, glow, grain, hand_drawn, hand_drawn_outline, handmade_3d, infantile_sketch, kawaii, pixel_art, plastic, psychedelic, seamless, voxel, watercolor - recraftv3 with style vector_illustration: bold_stroke, chemistry, colored_stencil, cosmics, cutout, depressive, editorial, emotional_flat, engraving, line_art, line_circuit, linocut, marker_outline, mosaic, naivector, roundish_flat, seamless, segmented_colors, sharp_contrast, thin, vector_photo, vivid_shapes - recraftv2 with style vector_illustration: cartoon, doodle_line_art, engraving, flat_2, kawaii, line_art, line_circuit, linocut, seamless - recraftv2 with style icon: broken_line, colored_outline, colored_shapes, colored_shapes_gradient, doodle_fill, doodle_offset_fill, offset_fill, outline, outline_gradient, pictogram - recraftv3 with style logo_raster: emblem_graffiti, emblem_pop_art, emblem_punk, emblem_stamp, emblem_vintage If you will provide a substyle that is not available for the specified model and style, generation will fail. You should provide the same style/substyle/styleID settings as were used for input image generation (if they exist) if there are no specific requirements to change the style in the resulting image.
styleIDNoID of the style to apply. Mutually exclusive with style, you can't specify both of them. This ID can be the style ID from recraft.ai or some previously created custom style. You should provide the same style/substyle/styleID settings as were used for input image generation (if they exist) if there are no specific requirements to change the style in the resulting image.
modelNoModel version to use. Default is recraftv3. - recraftv3 is the latest model and should be used in most cases. - recraftv2 is the previous state model, it has a bit cheaper generation. Be accurate with compatibility of model with style if it is specified, otherwise generation will fail.
numberOfImagesNoNumber of images to generate. Should be from 1 to 6. Default is 1.

Implementation Reference

  • The main handler function for the image_to_image tool. It validates args using zod, downloads the input image, calls server.api.imageApi.imageToImage(), and transforms the response into a CallToolResult.
    export const imageToImageHandler = async (server: RecraftServer, args: Record<string, unknown>): Promise<CallToolResult> => {
      try {
        const { imageURI, prompt, strength, style, substyle, styleID, model, numberOfImages } = z.object({
          imageURI: z.string(),
          prompt: z.string(),
          strength: z.number(),
          style: z.nativeEnum(ImageStyle).optional(),
          substyle: z.nativeEnum(ImageSubStyle).optional(),
          styleID: z.string().optional(),
          model: z.nativeEnum(TransformModel).optional(),
          numberOfImages: z.number().optional()
        }).parse(args)
    
        const imageData = await downloadImage(imageURI)
    
        const result = await server.api.imageApi.imageToImage({
          image: await imageDataToBlob(imageData),
          prompt: prompt,
          strength: strength,
          style: styleID ? undefined : style,
          substyle: styleID ? undefined : substyle,
          styleId: styleID,
          model: model,
          responseFormat: 'url',
          n: numberOfImages,
          expire: server.isLocalResultsStorage,
        })
    
        return await server.transformGenerateImageResponseToCallToolResult(result)
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error generating image: ${error}`
            }
          ],
          isError: true
        }
      }
    }
  • Input schema definition for the image_to_image tool, defining properties (imageURI, prompt, strength, style, substyle, styleID, model, numberOfImages) and required fields.
      inputSchema: {
        type: "object",
        properties: {
          imageURI: PARAMETERS.imageURI,
          prompt: PARAMETERS.promptSimple,
          strength: {
            type: "number",
            minimum: 0.0,
            maximum: 1.0,
            description: "Strength of the image to image transformation, where 0 means almost similar to reference input image, 1 means almost no reference."
          },
          style: {
            ...PARAMETERS.imageStyle,
            description: PARAMETERS.imageStyle.description + "\n" + STYLE_PRESERVATION_WARNING,
          },
          substyle: {
            ...PARAMETERS.imageSubStyle,
            description: PARAMETERS.imageSubStyle.description + "\n" + STYLE_PRESERVATION_WARNING,
          },
          styleID: {
            ...PARAMETERS.imageStyleID,
            description: PARAMETERS.imageStyleID.description + "\n" + STYLE_PRESERVATION_WARNING,
          },
          model: PARAMETERS.transformModel,
          numberOfImages: PARAMETERS.numberOfImages,
        },
        required: ["imageURI", "prompt", "strength"]
      }
    }
  • src/index.ts:108-109 (registration)
    Registration of the image_to_image tool via a switch case in the CallToolRequestSchema handler. Dispatches to imageToImageHandler when tool name matches.
    case imageToImageTool.name:
      return await imageToImageHandler(recraftServer, args ?? {})
  • src/index.ts:68-80 (registration)
    The tool is listed in the tools array returned by the ListToolsRequestSchema handler, making it available to clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          generateImageTool,
          createStyleTool,
          vectorizeImageTool,
          imageToImageTool,
          removeBackgroundTool,
          replaceBackgroundTool,
          crispUpscaleTool,
          creativeUpscaleTool,
          getUserTool,
        ],
  • The imageToImage method on ImageApi which posts a multipart/form-data request to /v1/images/imageToImage endpoint with all image generation parameters.
    async imageToImage(requestParameters: ImageToImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GenerateImageResponse> {
        const response = await this.imageToImageRaw(requestParameters, initOverrides);
        return await response.value();
    }
Behavior4/5

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

With no annotations, the description discloses the return format (local paths/URLs), style compatibility constraints, and mutual exclusivity of style and styleID. It does not cover rate limits or auth, but covers key behavioral aspects.

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

Conciseness3/5

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

The description is verbose with repeated phrases about using same style as input. While complex details are needed, it could be more concise without losing essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 8-parameter tool without output schema, the description covers parameter behavior, style validation, and expected outputs. It lacks error handling details but is largely complete for typical usage.

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

Parameters5/5

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

Schema coverage is 100%, but description adds substantial value: explains style/substyle use-cases, model compatibility, default values, and mutual exclusivity. This goes well beyond the schema's enums and descriptions.

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 clearly states the tool's verb ('Generate an image') and resource ('from an input image and a text prompt'), distinguishing it from siblings like 'generate_image' (text-to-image) and other editing tools.

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

Usage Guidelines4/5

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

It provides guidance on when to use (e.g., when you have an input image) and recommends keeping defaults unless specific requirements. It does not explicitly contrast with siblings but implies the context.

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/recraft-ai/mcp-recraft-server'

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