Skip to main content
Glama

comfy_generate_simple

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

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

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

Implementation Reference

  • src/server.ts:72-76 (registration)
    Registration of the 'comfy_generate_simple' tool in the ListToolsRequestHandler, including name, description, and input schema reference.
    {
      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 case in CallToolRequestHandler that invokes the handleGenerateSimple function for the tool.
    case 'comfy_generate_simple':
      return await handleGenerateSimple(args as any);
  • 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()
    });
  • Core implementation of the comfy_generate_simple tool. Retrieves a workflow template builder based on the specified template, optionally uploads input image for img2img, constructs the workflow with provided parameters, submits it to ComfyUI, and returns the queue response.
    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
        };
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions 'quick image generation' and 'pre-configured workflow templates,' it doesn't disclose critical behavioral traits like whether this is a synchronous or asynchronous operation, how long generation typically takes, what happens to queued jobs, error handling, or authentication requirements. For a complex image generation tool with 14 parameters, this leaves significant behavioral gaps.

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 concise with two sentences that efficiently convey the core value proposition. The first sentence establishes the main functionality with specific template examples, and the second sentence provides usage context. There's no wasted verbiage, though it could be slightly more structured with clearer separation of key concepts.

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

Completeness2/5

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

Given the tool's complexity (14 parameters, image generation functionality), absence of annotations, and lack of output schema, the description is insufficiently complete. It doesn't explain what the tool returns (images, job IDs, status?), error conditions, performance characteristics, or how it integrates with sibling tools like comfy_get_output_images. For a generative AI tool with significant computational implications, more contextual information is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for 14 parameters, the description provides minimal parameter guidance. It only mentions template names in the enum list but doesn't explain what each template does, when to choose which template, or how parameters like 'input_image' relate to 'basic_img2img' template. The description fails to compensate for the complete lack of schema descriptions, leaving most parameters semantically unclear.

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 as 'Quick image generation using pre-configured workflow templates' with specific template names listed. It distinguishes itself from sibling tools by emphasizing simplicity for 'common use cases without managing workflow JSON,' differentiating from more complex workflow management tools like comfy_submit_workflow. However, it doesn't explicitly contrast with all siblings like comfy_get_output_images.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by stating it's 'ideal for common use cases without managing workflow JSON,' suggesting when to use this simplified tool versus more complex workflow management alternatives. However, it doesn't explicitly state when NOT to use it or name specific alternative tools for different scenarios, leaving some ambiguity about optimal use cases.

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

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