Skip to main content
Glama

comfy_load_workflow

Load saved workflows from the ComfyUI library by name to retrieve workflow JSON and metadata for AI image generation projects.

Instructions

Load a saved workflow from the MCP library by name. Returns the workflow JSON and metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • The handleLoadWorkflow function that executes the tool logic for comfy_load_workflow, loading from library and returning formatted JSON response or error.
    export async function handleLoadWorkflow(input: LoadWorkflowInput) { try { const data = loadWorkflowFromLibrary(input.name); return { content: [{ type: "text", text: JSON.stringify({ name: data.name, workflow: data.workflow, description: data.description, tags: data.tags, created_at: data.created_at, updated_at: data.updated_at }, null, 2) }] }; } catch (error: any) { if (error.message.includes('not found')) { return { content: [{ type: "text", text: JSON.stringify(ComfyUIErrorBuilder.fileNotFound(input.name), null, 2) }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(ComfyUIErrorBuilder.executionError(error.message), null, 2) }], isError: true }; } }
  • Supporting utility function loadWorkflowFromLibrary that reads and parses the workflow JSON from the filesystem library.
    export function loadWorkflowFromLibrary(name: string): any { const config = getConfig(); const libraryPath = getFullPath(config.paths.workflow_library); const filePath = join(libraryPath, `${name}.json`); if (!existsSync(filePath)) { throw new Error(`Workflow not found: ${name}`); } const data = readFileSync(filePath, 'utf-8'); return JSON.parse(data); }
  • src/server.ts:97-101 (registration)
    Registration of the comfy_load_workflow tool in the ListTools handler, including name, description, and input schema.
    { name: 'comfy_load_workflow', description: 'Load a saved workflow from the MCP library by name. Returns the workflow JSON and metadata.', inputSchema: zodToJsonSchema(LoadWorkflowSchema) as any, },
  • src/server.ts:167-168 (registration)
    Dispatch case in the CallToolRequestHandler switch statement that invokes the handleLoadWorkflow function.
    case 'comfy_load_workflow': return await handleLoadWorkflow(args as any);
  • Zod input schema definition for the tool, requiring a 'name' string parameter.
    export const LoadWorkflowSchema = z.object({ name: z.string() });

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