UNPKG

comfyui-mcp

Version:

Local-first, agent-native control plane for ComfyUI — MCP server + autonomous sidebar agent that drives your live graph in natural language on ANY LLM: Claude/ChatGPT/Gemini on your subscription (no API key), free local models via Ollama (fully offline),

53 lines • 2.25 kB
// The audio-generation tool originally contributed by @x-yahya997 in // `x-yahya997/comfyui-mcp@c2ff7a9` and merged here with thanks. import { generateAudio as generateAudioService, } from "../services/generate-audio.js"; import { enqueueWorkflow } from "../services/workflow-executor.js"; import { listLocalModels } from "../services/model-resolver.js"; async function resolveFirstModel(type) { try { const models = await listLocalModels(type); return models[0]?.name; } catch { return undefined; } } const deps = { resolveFirstModel, enqueue: (workflow) => enqueueWorkflow(workflow), }; /** * `generate_image (action:"audio")` — the handler the standalone audio tool * used to carry (0.50.0 slice 16), unchanged apart from losing its own * registration. * * The service call, its deps and the returned JSON (status/model_family/ * prompt_id/queue_remaining/note) are identical. The try/catch moved OUT to the * dispatcher in generate-image.ts, which applies the same `errorToToolResult`. * The args object is built FIELD BY FIELD rather than spread from the shared * flat schema, so no parameter belonging to another action can reach this * service. */ export async function generateAudioAction(args) { const result = await generateAudioService(args, deps); return { content: [ { type: "text", text: JSON.stringify({ status: "enqueued", model_family: result.model_family, prompt_id: result.prompt_id, queue_remaining: result.queue_remaining, // #1037 — a 200 from /prompt does not mean every output was accepted; // ComfyUI queues the branches that validate and reports the rest. ...(result.rejectedOutputs ? { rejected_outputs: result.rejectedOutputs } : {}), note: "asset_id will be available in the completion notification; the SaveAudioMP3 node writes the output file to ComfyUI's output directory.", }, null, 2), }, ], }; } //# sourceMappingURL=generate-audio.js.map