submit_workflow
Submit a ComfyUI workflow for execution and receive a prompt ID for tracking progress without waiting for completion.
Instructions
Submit a workflow without waiting for completion.
Args:
workflow: Workflow dict to execute
Returns the prompt_id for tracking.
Use get_history() or get_prompt_status() to check completion.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow | Yes | Workflow to submit |
Implementation Reference
- The primary implementation of the 'submit_workflow' MCP tool. This function is decorated with @mcp.tool() for automatic registration and schema definition via Pydantic Field annotations. It submits the provided workflow dictionary to the ComfyUI server via POST /prompt and returns a dictionary containing the prompt_id, number, and any node_errors.@mcp.tool() def submit_workflow( workflow: dict = Field(description="Workflow to submit"), ctx: Context = None, ) -> dict: """Submit a workflow without waiting for completion. Args: workflow: Workflow dict to execute Returns the prompt_id for tracking. Use get_history() or get_prompt_status() to check completion. """ if ctx: ctx.info("Submitting workflow...") status, resp = comfy_post("/prompt", {"prompt": workflow}) if status != 200: return ErrorResponse( error=f"Submit failed: status {status}", code="SUBMIT_FAILED", details=resp, ).model_dump() return { "prompt_id": resp.get("prompt_id"), "number": resp.get("number"), "node_errors": resp.get("node_errors", {}), }
- src/comfy_mcp_server/tools/__init__.py:23-28 (registration)High-level registration function that calls register_execution_tools(mcp), which in turn defines and registers the submit_workflow tool among others.def register_all_tools(mcp): """Register all tools with the MCP server.""" register_system_tools(mcp) register_discovery_tools(mcp) register_workflow_tools(mcp) register_execution_tools(mcp)
- src/comfy_mcp_server/__init__.py:92-92 (registration)Top-level call to register_all_tools during server initialization, which indirectly registers the submit_workflow tool.register_all_tools(mcp)