Skip to main content
Glama

run_workflow_template

Run a saved workflow template against ComfyUI and receive the generated image URLs.

Instructions

Run a saved workflow template against ComfyUI and return the resulting image URLs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesSaved template name to run.

Implementation Reference

  • Handler for the 'run_workflow_template' tool. Reads a saved template from disk, parses it as StoredTemplate, calls client.runWorkflow(record.workflow) to execute it against ComfyUI, and returns the prompt ID and image URLs.
    server.tool(
      "run_workflow_template",
      "Run a saved workflow template against ComfyUI and return the resulting image URLs.",
      runSchema,
      async (args) => {
        validateName(args.name);
        let raw: string;
        try {
          raw = await fs.readFile(templatePath(store.dir, args.name), "utf-8");
        } catch {
          throw new Error(`Template "${args.name}" not found.`);
        }
        const record = JSON.parse(raw) as StoredTemplate;
        const result = await client.runWorkflow(record.workflow);
        const lines = [
          `Ran template "${record.name}" (prompt_id: ${result.promptId}), ${result.images.length} image(s):`,
          ...result.images.map((u, i) => `  ${i + 1}. ${u}`),
        ];
        return {
          content: [{ type: "text" as const, text: lines.join("\n") }],
        };
      },
    );
  • Input schema for 'run_workflow_template': requires a single 'name' string parameter identifying the saved template.
    const runSchema = {
      name: z.string().describe("Saved template name to run."),
    };
  • src/server.ts:48-49 (registration)
    Registration call: registerTemplateTools(s, client, templateStore) is invoked during server setup, which registers all template tools including 'run_workflow_template' on the MCP server.
    registerTemplateTools(s, client, templateStore);
    return s;
  • The registerTemplateTools function that registers all template tools (save, list, get, delete, run) on the MCP server. The 'run_workflow_template' tool is registered at line 217-239 via server.tool().
    export function registerTemplateTools(
      server: McpServer,
      client: ComfyUIClient,
      store: TemplateStore,
    ): void {
  • The client.runWorkflow method used by the handler: submits the workflow to ComfyUI and waits for completion, returning promptId and image URLs.
    async runWorkflow(workflow: Workflow): Promise<GenerateResult> {
      const { prompt_id } = await this.submit(workflow);
      const entry = await this.waitForCompletion(prompt_id);
      return {
        promptId: prompt_id,
        images: extractImageUrls(entry, this.publicUrl),
      };
    }
Behavior2/5

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

No annotations are provided, so the description must carry the full burden of behavioral disclosure. It states the tool returns image URLs but does not mention potential side effects (e.g., resource consumption, temporary storage, or error handling). For a tool that executes a workflow, this is insufficient transparency.

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 a single, concise sentence that communicates the core action and output. It is front-loaded and to the point, but could benefit from additional context (e.g., error conditions) without becoming overly verbose.

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

Completeness3/5

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

Given the tool's simplicity (one parameter, no output schema, no annotations), the description provides the basic function and output. However, it lacks information about prerequisites (e.g., template existence), error handling, or performance considerations, leaving some gaps for a complete understanding.

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

Parameters3/5

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

The input schema has 100% coverage with a description for the sole parameter 'name' as 'Saved template name to run.' The tool description adds no additional meaning beyond what the schema already provides. Baseline 3 is appropriate.

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 (run), the specific resource (saved workflow template), the target system (ComfyUI), and the output (image URLs). This distinguishes it from sibling tools like 'generate_image' (standalone generation) and 'generate_with_workflow' (generic workflow).

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 when to use: when you have a saved template to run. However, it does not explicitly state when not to use this tool nor mentions alternatives like 'generate_with_workflow' for non-template workflows. The purpose is clear, but usage boundaries are only implicitly suggested.

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/miller-joe/comfyui-mcp'

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