Skip to main content
Glama
recraft-ai

Recraft AI MCP Server

Official

create_style

Generate custom visual styles by extracting patterns from reference images for use in image generation tools. Input includes style type and 1-5 image URLs or file paths, output provides the style ID.

Instructions

Create a style in Recraft from the set of style reference images. A style is extracted from the provided images and can be used in image generation tools. ID of the created style will be returned in the response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageURIsYesArray of images to use as a style references. Each item can be a URL (starting with http:// or https://) or a file path (starting with file://). The length should be from 1 to 5.
styleYesBasic visual style in which the style will be created.

Implementation Reference

  • The createStyleHandler function that executes the 'create_style' tool: parses and validates arguments, downloads images from URIs, converts to blobs, calls the API to create style, and returns appropriate text content.
    export const createStyleHandler = async (server: RecraftServer, args: Record<string, unknown>): Promise<CallToolResult> => {
      try {
        const { style, imageURIs } = z.object({
          style: z.nativeEnum(ImageStyle),
          imageURIs: z.array(z.string()).nonempty(),
        }).parse(args)
    
    
        const blobPromises = imageURIs.map(async (imageURI) => await downloadImage(imageURI).then(imageDataToBlob))
        const blobs = await Promise.all(blobPromises)
    
        const result = await server.api.styleApi.createStyle({
          style: style,
          images: blobs,
        })
    
        return {
          content: [
            {
              type: 'text',
              text: `A new style with style_id ${result.id} created.\nYou can use this style in the image generation tools.`
            }
          ],
          isError: false
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error creating style: ${error}`
            }
          ],
          isError: true
        }
      }
    }
  • The createStyleTool object defines the tool's name, description, and inputSchema for validation, which specifies 'style' enum and 'imageURIs' array.
    export const createStyleTool = {
      name: "create_style",
      description: "Create a style in Recraft from the set of style reference images.\n" +
        "A style is extracted from the provided images and can be used in image generation tools.\n" +
        "ID of the created style will be returned in the response.",
      inputSchema: {
        type: "object",
        properties: {
          style: {
            type: "string",
            enum: [ImageStyle.RealisticImage, ImageStyle.DigitalIllustration, ImageStyle.VectorIllustration, ImageStyle.Icon],
            description: "Basic visual style in which the style will be created."
          },
          imageURIs: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Array of images to use as a style references. Each item can be a URL (starting with http:// or https://) or a file path (starting with file://). The length should be from 1 to 5."
          },
        },
        required: ["style", "imageURIs"]
      }
  • src/index.ts:68-82 (registration)
    Registration of the 'create_style' tool in the MCP server's list of available tools via createStyleTool inclusion in the ListToolsRequest handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          generateImageTool,
          createStyleTool,
          vectorizeImageTool,
          imageToImageTool,
          removeBackgroundTool,
          replaceBackgroundTool,
          crispUpscaleTool,
          creativeUpscaleTool,
          getUserTool,
        ],
      }
    })
  • src/index.ts:104-105 (registration)
    Handler dispatch registration: maps 'create_style' tool calls to the createStyleHandler function in the CallToolRequest switch statement.
    case createStyleTool.name:
      return await createStyleHandler(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 that the tool creates a style from images and returns an ID, which covers basic behavior. However, it lacks details on permissions, rate limits, error handling, or whether the operation is idempotent, which are important for a creation tool.

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 front-loaded with the core purpose in the first sentence, followed by two concise sentences that add value about usage and output. Every sentence earns its place without redundancy, making it highly efficient and well-structured.

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 tool's complexity (creation with 2 parameters) and no output schema, the description is mostly complete—it explains the purpose, usage, and output. However, it could improve by addressing behavioral aspects like error cases or dependencies, slightly reducing completeness.

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?

The input schema has 100% description coverage, so the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as explaining the style enum options or imageURI constraints, resulting in a baseline score of 3.

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 ('Create a style'), the resource ('in Recraft'), and the source ('from the set of style reference images'). It distinguishes this from sibling tools like generate_image or image_to_image by focusing on style creation rather than image generation or transformation.

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 usage by stating that the created style 'can be used in image generation tools,' suggesting it's a prerequisite for tools like generate_image. However, it doesn't explicitly state when to use this tool versus alternatives or provide exclusions, leaving some ambiguity.

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