Skip to main content
Glama

upscale_image

Provide an image URL and choose an upscaler model (ESRGAN, SwinIR). The tool fetches the image, runs the upscale through ComfyUI, and outputs the URL of the upscaled result.

Instructions

Upscale an image using a loaded upscaler model (ESRGAN, SwinIR, etc.). Fetches the source image, uploads to ComfyUI, runs the upscale node, and returns the output URL. Requires at least one upscaler model in ComfyUI's models/upscale_models/ directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_image_urlYesURL of the image to upscale. Will be fetched and uploaded to ComfyUI.
upscale_modelYesUpscaler model filename (e.g. RealESRGAN_x4plus.pth). Use list_models with kind=upscalers to see what's installed.

Implementation Reference

  • Registers the 'upscale_image' MCP tool. The handler fetches the source image URL, builds an upscale workflow (LoadImage -> UpscaleModelLoader -> ImageUpscaleWithModel -> SaveImage), executes it via ComfyUIClient, and returns the output image URLs.
    export function registerUpscaleTool(
      server: McpServer,
      client: ComfyUIClient,
    ): void {
      server.tool(
        "upscale_image",
        "Upscale an image using a loaded upscaler model (ESRGAN, SwinIR, etc.). Fetches the source image, uploads to ComfyUI, runs the upscale node, and returns the output URL. Requires at least one upscaler model in ComfyUI's models/upscale_models/ directory.",
        upscaleImageSchema,
        async (args) => {
          const uploaded = await client.fetchAndUploadImage(args.source_image_url);
          const workflow = upscale({
            sourceImage: uploaded.name,
            upscaleModel: args.upscale_model,
          });
          const result = await client.runWorkflow(workflow);
          const lines = [
            `Upscaled image (prompt_id: ${result.promptId}, model: ${args.upscale_model}):`,
            ...result.images.map((url, i) => `  ${i + 1}. ${url}`),
          ];
          return { content: [{ type: "text" as const, text: lines.join("\n") }] };
        },
      );
    }
  • Defines the input schema for the 'upscale_image' tool: source_image_url (string URL) and upscale_model (string filename of an upscaler model like RealESRGAN_x4plus.pth).
    const upscaleImageSchema = {
      source_image_url: z
        .string()
        .url()
        .describe("URL of the image to upscale. Will be fetched and uploaded to ComfyUI."),
      upscale_model: z
        .string()
        .describe(
          "Upscaler model filename (e.g. RealESRGAN_x4plus.pth). Use list_models with kind=upscalers to see what's installed.",
        ),
    };
  • src/server.ts:44-44 (registration)
    Registration call that wires 'registerUpscaleTool' into the MCP server during initialization.
    registerUpscaleTool(s, client);
  • The 'upscale' helper function defines the ComfyUI workflow JSON for upscaling: loads the source image, loads the upscaler model, applies ImageUpscaleWithModel, and saves the result.
    export function upscale(params: UpscaleParams): Workflow {
      return {
        "1": {
          class_type: "LoadImage",
          inputs: { image: params.sourceImage },
        },
        "2": {
          class_type: "UpscaleModelLoader",
          inputs: { model_name: params.upscaleModel },
        },
        "3": {
          class_type: "ImageUpscaleWithModel",
          inputs: { upscale_model: ["2", 0], image: ["1", 0] },
        },
        "4": {
          class_type: "SaveImage",
          inputs: { filename_prefix: "comfyui-mcp-upscale", images: ["3", 0] },
        },
      };
    }
  • The 'listUpscaleModels' method on ComfyUIClient queries ComfyUI for available upscaler model names from the UpscaleModelLoader node, supporting the list_models tool.
    async listUpscaleModels(): Promise<string[]> {
      return this.listNodeOptions("UpscaleModelLoader", "model_name");
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses the steps (fetch, upload, run node, return URL) and a requirement. However, it lacks details on error handling, synchronicity, or side effects, which is adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded purpose, no redundant words. Every part is informative and necessary.

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

Completeness4/5

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

Given the tool's simplicity (2 params, no output schema), the description covers the main process and prerequisite. It could mention output format or error cases, but is mostly complete for a straightforward tool.

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

Parameters4/5

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

Schema coverage is 100% with clear descriptions for both parameters. The description adds value beyond schema by explaining the model directory and suggesting list_models, enhancing usability.

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 (upscale an image) and the resource (loaded upscaler model), with examples (ESRGAN, SwinIR). It distinguishes from siblings by specifying the mechanism and prerequisites, unlike refine_image or generate_image.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use (upscaling with a loaded model) and provides a prerequisite (model must be in directory). It does not explicitly exclude alternatives or compare to siblings, but the context is clear.

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