Skip to main content
Glama

Submit ComfyUI Workflow

comfy_submit_workflow

Submit a ComfyUI workflow JSON to a local or cloud /prompt endpoint to trigger automated image-to-video generation and processing.

Instructions

Submit a ComfyUI workflow JSON to local or cloud ComfyUI /prompt endpoint.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetNolocal
workflowPathYesPath under VIDEO_FACTORY_ROOT to ComfyUI workflow JSON
clientIdNomcp-video-factory
extraDataNo

Implementation Reference

  • Handler function that reads a workflow JSON from file, POSTs it to the ComfyUI /prompt endpoint, and returns the response.
    async ({ target, workflowPath, clientId, extraData }) => {
      try {
        const workflow = await readJsonFile(safePath(workflowPath));
        const res = await fetch(`${comfyUrl(target)}/prompt`, {
          method: 'POST',
          headers: { 'content-type': 'application/json' },
          body: JSON.stringify({ prompt: workflow, client_id: clientId, extra_data: extraData ?? {} })
        });
        const body = await res.json().catch(() => ({}));
        if (!res.ok) return errorResult(`ComfyUI request failed: ${res.status}`, body);
        return textResult({ ok: true, target, response: body });
      } catch (err) {
        return errorResult('Failed to submit ComfyUI workflow', String(err));
      }
    }
  • Zod input schema defining the tool's parameters: target, workflowPath, clientId, and optional extraData.
    inputSchema: z.object({
      target: z.enum(['local', 'cloud']).default('local'),
      workflowPath: z.string().describe('Path under VIDEO_FACTORY_ROOT to ComfyUI workflow JSON'),
      clientId: z.string().default('mcp-video-factory'),
      extraData: z.record(z.unknown()).optional()
    })
  • Registration of the tool named 'comfy_submit_workflow' on the McpServer via registerTool(), exported by registerComfyTools().
    server.registerTool(
      'comfy_submit_workflow',
      {
        title: 'Submit ComfyUI Workflow',
        description: 'Submit a ComfyUI workflow JSON to local or cloud ComfyUI /prompt endpoint.',
        inputSchema: z.object({
          target: z.enum(['local', 'cloud']).default('local'),
          workflowPath: z.string().describe('Path under VIDEO_FACTORY_ROOT to ComfyUI workflow JSON'),
          clientId: z.string().default('mcp-video-factory'),
          extraData: z.record(z.unknown()).optional()
        })
      },
      async ({ target, workflowPath, clientId, extraData }) => {
        try {
          const workflow = await readJsonFile(safePath(workflowPath));
          const res = await fetch(`${comfyUrl(target)}/prompt`, {
            method: 'POST',
            headers: { 'content-type': 'application/json' },
            body: JSON.stringify({ prompt: workflow, client_id: clientId, extra_data: extraData ?? {} })
          });
          const body = await res.json().catch(() => ({}));
          if (!res.ok) return errorResult(`ComfyUI request failed: ${res.status}`, body);
          return textResult({ ok: true, target, response: body });
        } catch (err) {
          return errorResult('Failed to submit ComfyUI workflow', String(err));
        }
      }
    );
  • Helper function comfyUrl() that returns the base URL for local or cloud ComfyUI endpoint, used by the handler.
    export function comfyUrl(target: Target) {
      if (target === 'cloud') {
        if (!config.comfyCloudUrl) throw new Error('COMFY_CLOUD_URL is not configured');
        return config.comfyCloudUrl.replace(/\/$/, '');
      }
      return config.comfyLocalUrl.replace(/\/$/, '');
    }
  • Helper function readJsonFile() that reads and parses a JSON file, used by the handler to load the workflow.
    export async function readJsonFile<T = unknown>(filePath: string): Promise<T> {
      const raw = await fs.readFile(filePath, 'utf8');
      return JSON.parse(raw) as T;
    }
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only mentions submission to an endpoint without explaining if it is asynchronous, what the response looks like, side effects, or required permissions. This is insufficient 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.

Conciseness3/5

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

The description is a single sentence, which is concise but lacks necessary detail. It is front-loaded with the action, but does not earn its place fully due to missing critical information. A longer description with more context would be more valuable.

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 has 4 parameters (including a nested object) and no output schema, the description is far from complete. It does not explain return values, error handling, or operational behavior, leaving significant gaps for an agent to use the tool correctly.

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?

Schema description coverage is only 25% (only workflowPath has a description). The description adds minimal meaning beyond the schema; it mentions 'local or cloud' which corresponds to the target enum but does not elaborate on the other parameters like clientId or extraData, failing to compensate for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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 the resource (ComfyUI workflow JSON to /prompt endpoint). It specifies the target options (local or cloud), distinguishing it from sibling tools like comfy_get_history which retrieves history.

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 (submitting a workflow to run) but does not explicitly state when to use or when not to use. No alternatives or exclusions are mentioned, leaving the agent to infer from context.

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/Eliveral/codex-mcp-comfy-ae-video-factory-mcp'

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