crisp_upscale
Upscale an image to make it sharper and cleaner. A faster and cheaper alternative to creative upscale.
Instructions
Crisp upscale of the input image using Recraft. This operation takes an input image and returns an upscaled image, making the image sharper and cleaner. This version of upscale is much cheaper and faster than creative upscale. Local path or URL to resulting image and its preview will be returned in the response.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| imageURI | Yes | Image 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
- src/tools/CrispUpscale.ts:23-49 (handler)The main handler function for the crisp_upscale tool. It parses the imageURI argument, downloads the image, calls the crispUpscale API, and returns the result.
export const crispUpscaleHandler = 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.crispUpscale({ image: await imageDataToBlob(imageData), responseFormat: 'url', expire: server.isLocalResultsStorage, }) return await server.transformSingleImageOperationToCallToolResult(result.image, 'Crisp upscale completed.') } catch (error) { return { content: [ { type: 'text', text: `Crisp upscale error: ${error}` } ], isError: true } } } - src/tools/CrispUpscale.ts:8-21 (schema)The tool definition including name ('crisp_upscale'), description, and inputSchema (requires imageURI).
export const crispUpscaleTool = { name: "crisp_upscale", description: "Crisp upscale of the input image using Recraft.\n" + "This operation takes an input image and returns an upscaled image, making the image sharper and cleaner.\n" + "This version of upscale is much cheaper and faster than creative upscale.\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/api/apis/ImageApi.ts:66-71 (schema)The CrispUpscaleRequest interface defining the API request parameters (image Blob, expire, imageFormat, responseFormat).
export interface CrispUpscaleRequest { image: Blob; expire?: boolean; imageFormat?: ImageFormat; responseFormat?: ResponseFormat; } - src/index.ts:77-79 (registration)Registration of crispUpscaleTool in the server's tool list.
crispUpscaleTool, creativeUpscaleTool, getUserTool, - src/index.ts:114-115 (registration)Handler dispatch for crisp_upscale in the CallToolRequest handler switch statement.
case crispUpscaleTool.name: return await crispUpscaleHandler(recraftServer, args ?? {})