Skip to main content
Glama

comfy_submit_workflow

Execute ComfyUI workflows by submitting JSON with parameter overrides for dynamic image generation adjustments.

Instructions

Submit a complete workflow JSON to ComfyUI for execution. Supports parameter overrides for dynamic modifications without editing the workflow structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowYes
overridesNo
client_idNo

Implementation Reference

  • Core implementation of the comfy_submit_workflow tool handler. Parses input workflow JSON, validates it, applies optional parameter overrides, submits to ComfyUI API, and returns prompt_id, queue position, and status.
    export async function handleSubmitWorkflow(input: SubmitWorkflowInput) {
      try {
        const client = getComfyUIClient();
        const processor = new WorkflowProcessor();
    
        // Parse workflow
        const workflow = processor.parseWorkflow(input.workflow);
    
        // Validate workflow
        if (!validateWorkflowJSON(workflow)) {
          throw ComfyUIErrorBuilder.invalidWorkflow('Invalid workflow structure');
        }
    
        // Apply overrides
        const modifiedWorkflow = await processor.applyOverrides(workflow, input.overrides);
    
        // Submit to ComfyUI
        const response = await client.submitWorkflow(modifiedWorkflow, input.client_id);
    
        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
                ? "Workflow validation failed"
                : `Workflow queued successfully at position ${response.number}`,
              node_errors: response.node_errors
            }, null, 2)
          }]
        };
      } catch (error: any) {
        if (error.error) {
          // Already a ComfyUIError
          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 input schema for the tool, defining workflow (JSON string or object), optional overrides for common parameters like prompts, seed, dimensions, LoRAs, and optional client_id.
    export const SubmitWorkflowSchema = z.object({
      workflow: z.union([z.string(), z.record(z.any())]),
      overrides: z.object({
        positive_prompt: z.string().optional(),
        negative_prompt: z.string().optional(),
        seed: z.number().int().optional(),
        steps: z.number().int().min(1).max(150).optional(),
        cfg: z.number().min(0).max(30).optional(),
        sampler_name: z.string().optional(),
        scheduler: z.string().optional(),
        width: z.number().int().min(64).max(8192).optional(),
        height: z.number().int().min(64).max(8192).optional(),
        denoise: z.number().min(0).max(1).optional(),
        input_image: z.string().optional(),
        batch_size: z.number().int().min(1).max(100).optional(),
        model: z.string().optional(),
        vae: z.string().optional(),
        lora: z.array(z.object({
          name: z.string(),
          strength_model: z.number(),
          strength_clip: z.number()
        })).optional()
      }).optional(),
      client_id: z.string().optional()
    });
  • src/server.ts:68-70 (registration)
    Tool metadata registration in the ListTools response, including name, description, and derived JSON input schema.
    name: 'comfy_submit_workflow',
    description: 'Submit a complete workflow JSON to ComfyUI for execution. Supports parameter overrides for dynamic modifications without editing the workflow structure.',
    inputSchema: zodToJsonSchema(SubmitWorkflowSchema) as any,
  • src/server.ts:149-150 (registration)
    Handler dispatch in the CallToolRequest switch statement, routing tool calls to the handleSubmitWorkflow function.
    case 'comfy_submit_workflow':
      return await handleSubmitWorkflow(args as any);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions execution and parameter overrides but fails to cover critical aspects like whether this is a read-only or destructive operation, authentication needs, rate limits, or what happens upon submission (e.g., queueing, immediate execution). This leaves significant gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured in two sentences, front-loading the core purpose and adding a clarifying detail about overrides. Every word contributes meaning without redundancy, making it appropriately concise.

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 complexity (3 parameters with nested objects, no annotations, no output schema), the description is incomplete. It doesn't address execution outcomes, error handling, or the relationship between workflow and overrides, leaving the agent with insufficient context for reliable tool invocation.

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?

The schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'parameter overrides' and 'workflow JSON,' which loosely maps to the 'overrides' and 'workflow' parameters, but doesn't explain the 'client_id' parameter or provide details on override usage, format, or constraints. This adds minimal value beyond the schema.

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 action ('submit') and resource ('complete workflow JSON to ComfyUI for execution'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'comfy_generate_simple' or 'comfy_load_workflow', which prevents a perfect score.

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 implies usage context by mentioning 'parameter overrides for dynamic modifications without editing the workflow structure,' suggesting this tool is for executing workflows with customizations. However, it lacks explicit guidance on when to use this versus alternatives like 'comfy_generate_simple' or prerequisites, leaving some ambiguity.

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