Skip to content

feat: add inpainting params to image_generate tool (input_image, mask_image, cf_model) #67

@stackbilt-admin

Description

@stackbilt-admin

Problem

The image_generate MCP tool currently exposes input_asset_url and mode for img2img chaining, but inpainting params are missing entirely:

  • No input_image (base64 source)
  • No mask_image (base64 mask — white = regenerate, black = keep)
  • No cf_model field to target the inpainting model

Inpainting is not callable via MCP at all today.

Proposed Changes

Add to the image_generate tool schema in tool-registry.ts:

cf_model: {
  type: "string",
  description: "Target a specific CF Workers AI model. Use '@cf/runwayml/stable-diffusion-v1-5-inpainting' for surgical region edits.",
},
input_image: {
  type: "string",
  description: "Base64-encoded source image. Required for inpainting when input_asset_url is not available.",
},
mask_image: {
  type: "string",
  description: "Base64-encoded mask. White pixels = regenerate, black = keep. Required for inpainting.",
},

Note on base64 UX

Once img-forge supports input_asset_url for the inpainting model (tracked in img-forge#N), the canonical MCP flow becomes:

image_generate({
  prompt: "clean background",
  cf_model: "@cf/runwayml/stable-diffusion-v1-5-inpainting",
  input_asset_url: draft.asset_url,  // no base64 for source
  mask_image: "<small base64 mask>", // mask stays small
})

Both issues should ship together so the end-to-end MCP inpainting flow works without base64 source images.

Acceptance Criteria

  • cf_model, input_image, mask_image added to image_generate tool schema
  • Params passed through to img-forge /mcp handler unchanged
  • Tool description updated to mention inpainting use case
  • No breaking change to existing txt2img or img2img params

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions