Skip to main content
Glama
recraft-ai

Recraft AI MCP Server

Official

image_to_image

Transform an input image into a new visual creation using a text prompt and style adjustments. Specify style, model, and strength to generate raster or vector images tailored to your needs.

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://).
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.
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.
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.
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.

Implementation Reference

  • The handler function that implements the core logic of the image_to_image tool: parses arguments, downloads input image, calls Recraft API's imageToImage endpoint, and returns the result or error.
    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
        }
      }
    }
  • Tool definition including name, description, and input schema for validating parameters like imageURI, prompt, strength, style, etc.
    export const imageToImageTool = {
      name: "image_to_image",
      description: "Generate an image using Recraft from an input image and a text prompt.\n" +
        "You can specify the reference input image, style, model, and number of images to generate.\n" +
        "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.\n" +
        "Other parameters are recommended to keep default if you don't have any specific requirements on them.\n" +
        "You can use styles to refine the image generation, and also to generate raster or vector images.\n" +
        "Local paths or URLs to generated images and their previews will be returned in the response.",
      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:68-82 (registration)
    Registration of the image_to_image tool (imageToImageTool) in the MCP server's list of available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          generateImageTool,
          createStyleTool,
          vectorizeImageTool,
          imageToImageTool,
          removeBackgroundTool,
          replaceBackgroundTool,
          crispUpscaleTool,
          creativeUpscaleTool,
          getUserTool,
        ],
      }
    })
  • src/index.ts:108-109 (registration)
    Dispatch/registration of the imageToImageHandler in the tool call switch statement.
    case imageToImageTool.name:
      return await imageToImageHandler(recraftServer, args ?? {})
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: the tool generates images (implies creation/mutation), returns local paths or URLs to generated images and previews, and mentions potential generation failures with incompatible style/model combinations. However, it lacks details about authentication needs, rate limits, cost implications, or error handling for invalid inputs beyond style/model mismatches.

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 appropriately sized but not optimally structured. The first sentence clearly states the purpose, but subsequent sentences mix usage guidance, parameter advice, and output information without clear separation. Some redundancy exists (e.g., style inheritance mentioned multiple times), and the final sentence about return values could be more front-loaded.

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?

Given the complexity (8 parameters, 3 required), 100% schema coverage, and no output schema, the description provides adequate context. It explains the tool's purpose, key behavioral aspects (generation, returns, failures), and usage guidance. While it doesn't detail output format beyond paths/URLs, the schema's thoroughness compensates for most gaps, making it reasonably complete for agent use.

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 100%, so the schema already documents all 8 parameters thoroughly. The description adds minimal value beyond the schema, mainly reinforcing that styles refine generation and can produce raster/vector images. It doesn't provide additional semantic context or usage examples that aren't already covered in the parameter 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 specific action ('Generate an image using Recraft from an input image and a text prompt'), identifies the resource (images via Recraft), and distinguishes from siblings like generate_image (text-to-image) and vectorize_image (conversion). It explicitly mentions the transformation nature of image-to-image generation.

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?

The description provides clear context for when to use this tool (image-to-image generation with style control) and mentions style inheritance from input images. However, it doesn't explicitly contrast with alternatives like generate_image (text-to-image) or creative_upscale (enhancement), nor does it specify when NOT to use this tool versus those siblings.

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

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