Skip to main content
Glama

comfy_generate_simple

Generate images using pre-configured AI workflow templates for text-to-image and image-to-image tasks without managing complex JSON workflows.

Instructions

Quick image generation using pre-configured workflow templates (flux_txt2img, sd15_txt2img, sdxl_txt2img, basic_img2img). Ideal for common use cases without managing workflow JSON.

Input Schema

NameRequiredDescriptionDefault
promptYes
negative_promptNo
templateYes
modelNo
input_imageNo
widthNo
heightNo
stepsNo
cfgNo
seedNo
samplerNo
schedulerNo
denoiseNo
batch_sizeNo

Input Schema (JSON Schema)

{ "properties": { "batch_size": { "maximum": 100, "minimum": 1, "type": "integer" }, "cfg": { "maximum": 30, "minimum": 0, "type": "number" }, "denoise": { "maximum": 1, "minimum": 0, "type": "number" }, "height": { "maximum": 8192, "minimum": 64, "type": "integer" }, "input_image": { "type": "string" }, "model": { "type": "string" }, "negative_prompt": { "type": "string" }, "prompt": { "type": "string" }, "sampler": { "type": "string" }, "scheduler": { "type": "string" }, "seed": { "type": "integer" }, "steps": { "maximum": 150, "minimum": 1, "type": "integer" }, "template": { "enum": [ "flux_txt2img", "sd15_txt2img", "sdxl_txt2img", "basic_img2img" ], "type": "string" }, "width": { "maximum": 8192, "minimum": 64, "type": "integer" } }, "required": [ "prompt", "template" ], "type": "object" }

Implementation Reference

  • Main handler function that executes the comfy_generate_simple tool: validates template, uploads input image if needed, builds workflow using template builder, submits to ComfyUI, and returns prompt_id and status.
    export async function handleGenerateSimple(input: GenerateSimpleInput) { try { const client = getComfyUIClient(); // Get template builder const builder = getTemplateBuilder(input.template); if (!builder) { throw ComfyUIErrorBuilder.validationError(`Unknown template: ${input.template}`); } // Handle input image if needed let inputImage = input.input_image; if (input.template === 'basic_img2img') { if (!inputImage) { throw ComfyUIErrorBuilder.validationError('input_image is required for img2img template'); } // Upload the image const uploadResult = uploadImage(inputImage); inputImage = uploadResult.filename; } // Build workflow from template const workflow = builder({ prompt: input.prompt, negative_prompt: input.negative_prompt, width: input.width, height: input.height, steps: input.steps, cfg: input.cfg, seed: input.seed, sampler: input.sampler, scheduler: input.scheduler, model: input.model, denoise: input.denoise, batch_size: input.batch_size, input_image: inputImage }); // Submit to ComfyUI const response = await client.submitWorkflow(workflow); const summary = `${input.template} generation: ${input.prompt.substring(0, 50)}...`; return { content: [{ type: "text", text: JSON.stringify({ prompt_id: response.prompt_id, number: response.number, status: response.node_errors ? "failed" : "queued", message: response.node_errors ? "Generation failed" : `Generation queued successfully at position ${response.number}`, template_used: input.template, workflow_summary: summary }, null, 2) }] }; } catch (error: any) { if (error.error) { return { content: [{ type: "text", text: JSON.stringify(error, null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(ComfyUIErrorBuilder.executionError(error.message), null, 2) }], isError: true }; } }
  • Zod schema defining the input parameters and validation for the comfy_generate_simple tool.
    export const GenerateSimpleSchema = z.object({ prompt: z.string(), negative_prompt: z.string().optional(), template: z.enum(["flux_txt2img", "sd15_txt2img", "sdxl_txt2img", "basic_img2img"]), model: z.string().optional(), input_image: z.string().optional(), width: z.number().int().min(64).max(8192).optional(), height: z.number().int().min(64).max(8192).optional(), steps: z.number().int().min(1).max(150).optional(), cfg: z.number().min(0).max(30).optional(), seed: z.number().int().optional(), sampler: z.string().optional(), scheduler: z.string().optional(), denoise: z.number().min(0).max(1).optional(), batch_size: z.number().int().min(1).max(100).optional() });
  • src/server.ts:72-76 (registration)
    Tool registration in the MCP listTools response, providing name, description, and input schema.
    { name: 'comfy_generate_simple', description: 'Quick image generation using pre-configured workflow templates (flux_txt2img, sd15_txt2img, sdxl_txt2img, basic_img2img). Ideal for common use cases without managing workflow JSON.', inputSchema: zodToJsonSchema(GenerateSimpleSchema) as any, },
  • src/server.ts:152-153 (registration)
    Dispatch handler in the MCP CallToolRequest that routes calls to comfy_generate_simple to the implementation function.
    case 'comfy_generate_simple': return await handleGenerateSimple(args as any);

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/Nikolaibibo/claude-comfyui-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server