Skip to main content
Glama

vectorize_image

Convert an image into a scalable vector graphic (SVG) using Recraft AI. Input an image via URL or local path, and receive vectorized output with preview. Ideal for enhancing image quality and scalability.

Instructions

Vectorize an input image using Recraft. This operation takes an input image and returns a vector SVG image, close to it. 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 vectorizeImageHandler function that executes the tool logic: validates input, downloads image, calls the vectorizeImage API, handles result or error.
    export const vectorizeImageHandler = 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.vectorizeImage({ image: await imageDataToBlob(imageData), responseFormat: 'url', expire: server.isLocalResultsStorage, }) return await server.transformSingleImageOperationToCallToolResult(result.image, 'Vectorized given image.') } catch (error) { return { content: [ { type: 'text', text: `Vectorization error: ${error}` } ], isError: true } } }
  • The tool definition including name, description, and inputSchema for validation (requires imageURI).
    export const vectorizeImageTool = { name: "vectorize_image", description: "Vectorize an input image using Recraft.\n" + "This operation takes an input image and returns a vector SVG image, close to it.\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)
    Registration of the vectorizeImageTool in the ListToolsRequestHandler, including it in the list of available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ generateImageTool, createStyleTool, vectorizeImageTool, imageToImageTool, removeBackgroundTool, replaceBackgroundTool, crispUpscaleTool, creativeUpscaleTool, getUserTool, ], } })
  • src/index.ts:106-107 (registration)
    Dispatch registration in the CallToolRequestHandler switch statement, mapping vectorize_image tool calls to the handler.
    case vectorizeImageTool.name: return await vectorizeImageHandler(recraftServer, args ?? {})
  • src/index.ts:15-15 (registration)
    Import of the vectorizeImageTool and vectorizeImageHandler for use in the server.
    import { vectorizeImageHandler, vectorizeImageTool } from "./tools/VectorizeImage"

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