Skip to main content
Glama

comfy_submit_workflow

Execute ComfyUI workflows by submitting JSON with parameter overrides for prompts, models, dimensions, and other settings without modifying the workflow structure.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
workflowYes
overridesNo
client_idNo

Input Schema (JSON Schema)

{ "properties": { "client_id": { "type": "string" }, "overrides": { "additionalProperties": false, "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" }, "lora": { "items": { "additionalProperties": false, "properties": { "name": { "type": "string" }, "strength_clip": { "type": "number" }, "strength_model": { "type": "number" } }, "required": [ "name", "strength_model", "strength_clip" ], "type": "object" }, "type": "array" }, "model": { "type": "string" }, "negative_prompt": { "type": "string" }, "positive_prompt": { "type": "string" }, "sampler_name": { "type": "string" }, "scheduler": { "type": "string" }, "seed": { "type": "integer" }, "steps": { "maximum": 150, "minimum": 1, "type": "integer" }, "vae": { "type": "string" }, "width": { "maximum": 8192, "minimum": 64, "type": "integer" } }, "type": "object" }, "workflow": { "anyOf": [ { "type": "string" }, { "additionalProperties": {}, "type": "object" } ] } }, "required": [ "workflow" ], "type": "object" }

Implementation Reference

  • The core handler function for 'comfy_submit_workflow' that parses the input workflow, validates it, applies parameter overrides, and submits it to the ComfyUI API client.
    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 schema defining the input structure for the 'comfy_submit_workflow' tool, including workflow JSON or string and optional overrides for prompts, seeds, dimensions, models, LoRAs, etc.
    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:67-71 (registration)
    Registration of the 'comfy_submit_workflow' tool in the MCP server's listTools response, specifying name, description, and 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-151 (registration)
    Dispatch case in the MCP CallToolRequestHandler that routes calls to the 'comfy_submit_workflow' handler function.
    case 'comfy_submit_workflow': return await handleSubmitWorkflow(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