Skip to main content
Glama
recraft-ai

Recraft AI MCP Server

Official

remove_background

Remove the background from any input image using Recraft AI MCP Server. Process local files or URLs to generate a raster image with the background eliminated and receive paths for the result and preview.

Instructions

Remove background in the input image using Recraft. This operation takes an input image and returns the same image with detected background removed. Raster image will be always returned. Local path or URL to resulting image and its preview 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://).

Implementation Reference

  • The main handler function that executes the remove_background tool. It validates the imageURI input, downloads the image, calls the Recraft Image API to remove the background, transforms the result, or returns an error.
    export const removeBackgroundHandler = async (server: RecraftServer, args: Record<string, unknown>): Promise<CallToolResult> => {
      try {
        const { imageURI } = z.object({
          imageURI: z.string(),
        }).parse(args)
    
        const imageData = await downloadImage(imageURI)
    
        const result = await server.api.imageApi.removeBackground({
          image: await imageDataToBlob(imageData),
          responseFormat: 'url',
          expire: server.isLocalResultsStorage,
        })
    
        return await server.transformSingleImageOperationToCallToolResult(result.image, 'Removed background.')
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Remove Background error: ${error}`
            }
          ],
          isError: true
        }
      }
    }
  • Tool definition including name, description, and input schema (requiring imageURI parameter).
    export const removeBackgroundTool = {
      name: "remove_background",
      description: "Remove background in the input image using Recraft.\n" +
        "This operation takes an input image and returns the same image with detected background removed. Raster image will be always returned.\n" +
        "Local path or URL to resulting image and its preview will be returned in the response.",
      inputSchema: {
        type: "object",
        properties: {
          imageURI: PARAMETERS.imageURI,
        },
        required: ["imageURI"]
      }
    }
  • src/index.ts:68-82 (registration)
    Registers removeBackgroundTool in the list of tools advertised to MCP clients via ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          generateImageTool,
          createStyleTool,
          vectorizeImageTool,
          imageToImageTool,
          removeBackgroundTool,
          replaceBackgroundTool,
          crispUpscaleTool,
          creativeUpscaleTool,
          getUserTool,
        ],
      }
    })
  • src/index.ts:110-111 (registration)
    Routes calls to the remove_background tool to its handler in the main CallToolRequest switch statement.
    case removeBackgroundTool.name:
      return await removeBackgroundHandler(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 of behavioral disclosure. It adds useful context: specifies that 'Raster image will be always returned' and details the response format ('Local path or URL to resulting image and its preview'). However, it lacks information on permissions, rate limits, error conditions, or whether the operation is destructive to the original image.

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

Conciseness4/5

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

The description is appropriately sized with three sentences that are front-loaded: the first states the purpose, the second clarifies the output type, and the third details the response format. There is minimal waste, though the second sentence could be more concise by combining ideas.

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

Completeness3/5

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

Given the tool's moderate complexity (image processing with one parameter), no annotations, and no output schema, the description is partially complete. It covers the core operation and response format but misses behavioral aspects like error handling or performance characteristics. It's adequate for basic use but has clear gaps for robust agent interaction.

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 fully documents the single parameter 'imageURI.' The description does not add any parameter-specific details beyond what the schema provides (e.g., no extra constraints or examples). With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't need to.

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 tool's purpose: 'Remove background in the input image using Recraft' and specifies the outcome: 'returns the same image with detected background removed.' It distinguishes from siblings like 'replace_background' by focusing on removal rather than replacement. However, it doesn't explicitly contrast with 'vectorize_image' which might also involve background handling.

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?

The description provides no guidance on when to use this tool versus alternatives like 'replace_background' or 'vectorize_image.' It mentions the tool's function but offers no context about appropriate scenarios, prerequisites, or exclusions. Usage is implied from the purpose statement alone.

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