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),
50 lines • 1.95 kB
JavaScript
import { upscaleImage } from "../services/upscale-image.js";
import { enqueueWorkflow } from "../services/workflow-executor.js";
import { listLocalModels } from "../services/model-resolver.js";
async function resolveUpscaleModel() {
try {
const models = await listLocalModels("upscale_models");
return models[0]?.name;
}
catch {
return undefined;
}
}
const deps = {
resolveUpscaleModel,
enqueue: (workflow) => enqueueWorkflow(workflow),
};
/**
* `generate_image (action:"upscale")` — the handler the standalone upscale tool
* used to carry (0.50.0 slice 16), unchanged apart from losing its own
* registration.
*
* Same service, same deps, same returned JSON; only the `tool` label changed, to
* the live call form — see generateVideoAction for why. The try/catch moved OUT
* to the dispatcher in generate-image.ts.
*/
export async function upscaleImageAction(args) {
const result = await upscaleImage(args, deps);
return {
content: [
{
type: "text",
text: JSON.stringify({
status: "enqueued",
tool: 'generate_image (action:"upscale")',
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 }
: {}),
model: result.model,
scale: result.scale,
note: 'Upscaled asset_id arrives in the completion notification; use get_image (action:"view") with it.',
}, null, 2),
},
],
};
}
//# sourceMappingURL=upscale-image.js.map