Skip to main content
Glama

generate_with_ip_adapter

Use a reference image as a visual, style, or subject guide to generate new images. Adjust the weight to control how strongly the reference influences the output.

Instructions

Generate an image using a reference image as an IP-Adapter visual/style/subject guide. Requires the ComfyUI-IPAdapter-plus custom node pack and the preset's matching models (IPAdapter weights + CLIP vision). Weight tunes how strongly the reference guides generation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesText prompt for the generated image.
negative_promptNo
reference_image_urlYesURL of the reference image that IP-Adapter uses as a visual/style/subject guide.
presetNoIP-Adapter preset (picks the matching IPAdapter + CLIP Vision models). Common values: LIGHT - SD1.5 only (low strength) | STANDARD (medium strength) | VIT-G (medium strength) | PLUS (high strength) | PLUS FACE (portraits) | FULL FACE - SD1.5 only (portraits stronger)STANDARD (medium strength)
weightNoHow strongly the reference guides the output.
start_atNo
end_atNo
widthNo
heightNo
stepsNo
cfgNo
seedNo
checkpointNo

Implementation Reference

  • Tool handler for 'generate_with_ip_adapter' – registers an MCP tool that fetches a reference image, builds an IP-Adapter workflow, runs it via ComfyUI client, and returns generated image URLs.
    server.tool(
      "generate_with_ip_adapter",
      "Generate an image using a reference image as an IP-Adapter visual/style/subject guide. Requires the ComfyUI-IPAdapter-plus custom node pack and the preset's matching models (IPAdapter weights + CLIP vision). Weight tunes how strongly the reference guides generation.",
      ipAdapterSchema,
      async (args) => {
        const upload = await client.fetchAndUploadImage(args.reference_image_url);
    
        const workflow = ipAdapter({
          prompt: args.prompt,
          negativePrompt: args.negative_prompt ?? "",
          referenceImage: upload.name,
          preset: args.preset,
          weight: args.weight,
          startAt: args.start_at,
          endAt: args.end_at,
          width: args.width,
          height: args.height,
          steps: args.steps,
          cfg: args.cfg,
          seed: args.seed ?? Math.floor(Math.random() * 2 ** 32),
          checkpoint: args.checkpoint ?? DEFAULT_CHECKPOINT,
        });
    
        const result = await client.runWorkflow(workflow);
        const lines = [
          `Generated ${result.images.length} image(s) with IP-Adapter (preset: ${args.preset}, weight: ${args.weight}, prompt_id: ${result.promptId}):`,
          ...result.images.map((u, i) => `  ${i + 1}. ${u}`),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • Zod schema (ipAdapterSchema) defining the input parameters: prompt, negative_prompt, reference_image_url, preset, weight, start_at, end_at, width, height, steps, cfg, seed, checkpoint.
    const ipAdapterSchema = {
      prompt: z.string().min(1).describe("Text prompt for the generated image."),
      negative_prompt: z.string().optional(),
      reference_image_url: z
        .string()
        .url()
        .describe(
          "URL of the reference image that IP-Adapter uses as a visual/style/subject guide.",
        ),
      preset: z
        .string()
        .default("STANDARD (medium strength)")
        .describe(
          `IP-Adapter preset (picks the matching IPAdapter + CLIP Vision models). Common values: ${IP_ADAPTER_PRESETS.join(" | ")}`,
        ),
      weight: z
        .number()
        .min(0)
        .max(3)
        .default(1.0)
        .describe("How strongly the reference guides the output."),
      start_at: z.number().min(0).max(1).default(0),
      end_at: z.number().min(0).max(1).default(1),
      width: z.number().int().min(64).max(2048).default(1024),
      height: z.number().int().min(64).max(2048).default(1024),
      steps: z.number().int().min(1).max(150).default(25),
      cfg: z.number().min(1).max(30).default(7),
      seed: z.number().int().optional(),
      checkpoint: z.string().optional(),
    };
  • Registration function `registerConditioningTools` exports the tool registration. Called from server.ts line 47 where it's imported and invoked.
    export function registerConditioningTools(
      server: McpServer,
      client: ComfyUIClient,
    ): void {
  • IPAdapterParams interface and `ipAdapter()` workflow builder function – constructs the ComfyUI workflow JSON using IPAdapterUnifiedLoader and IPAdapterAdvanced nodes.
    export interface IPAdapterParams {
      prompt: string;
      negativePrompt: string;
      referenceImage: string;
      preset: string;
      weight: number;
      startAt: number;
      endAt: number;
      width: number;
      height: number;
      steps: number;
      cfg: number;
      seed: number;
      checkpoint: string;
    }
    
    /**
     * IP-Adapter workflow. Relies on the ComfyUI-IPAdapter-plus custom node pack
     * (nodes `IPAdapterUnifiedLoader`, `IPAdapterAdvanced`). If the pack or the
     * selected preset's models aren't installed, ComfyUI returns a node error.
     */
    export function ipAdapter(params: IPAdapterParams): Workflow {
      return {
        "4": {
          class_type: "CheckpointLoaderSimple",
          inputs: { ckpt_name: params.checkpoint },
        },
        "5": {
          class_type: "EmptyLatentImage",
          inputs: { width: params.width, height: params.height, batch_size: 1 },
        },
        "6": {
          class_type: "CLIPTextEncode",
          inputs: { text: params.prompt, clip: ["4", 1] },
        },
        "7": {
          class_type: "CLIPTextEncode",
          inputs: { text: params.negativePrompt, clip: ["4", 1] },
        },
        "10": {
          class_type: "LoadImage",
          inputs: { image: params.referenceImage },
        },
        "20": {
          class_type: "IPAdapterUnifiedLoader",
          inputs: { model: ["4", 0], preset: params.preset },
        },
        "21": {
          class_type: "IPAdapterAdvanced",
          inputs: {
            model: ["20", 0],
            ipadapter: ["20", 1],
            image: ["10", 0],
            weight: params.weight,
            weight_type: "linear",
            combine_embeds: "concat",
            start_at: params.startAt,
            end_at: params.endAt,
            embeds_scaling: "V only",
          },
        },
        "3": {
          class_type: "KSampler",
          inputs: {
            seed: params.seed,
            steps: params.steps,
            cfg: params.cfg,
            sampler_name: "euler",
            scheduler: "normal",
            denoise: 1,
            model: ["21", 0],
            positive: ["6", 0],
            negative: ["7", 0],
            latent_image: ["5", 0],
          },
        },
        "8": {
          class_type: "VAEDecode",
          inputs: { samples: ["3", 0], vae: ["4", 2] },
        },
        "9": {
          class_type: "SaveImage",
          inputs: { filename_prefix: "comfyui-mcp-ipa", images: ["8", 0] },
        },
      };
    }
Behavior3/5

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

No annotations are present, so the description carries the full burden. It discloses the requirement for specific custom node packs and models, and explains that weight affects guidance strength. However, it does not describe the generation behavior (e.g., non-destructive, no side effects), return format, or potential limitations (e.g., model compatibility).

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 three sentences long, starting with the core purpose, then prerequisites, then a single parameter explanation. It is front-loaded and avoids unnecessary text, though the third sentence could be integrated into the first.

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

Completeness2/5

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

The description lacks information about the output (e.g., returns an image URL), does not differentiate from sibling tools, and does not cover the majority of parameters. Given the complexity (13 parameters, no output schema), it is insufficient for an agent to fully determine correct usage.

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

Parameters2/5

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

With only 31% schema description coverage, the description must compensate but only mentions weight and the custom node requirement. It does not explain negative_prompt, start_at, end_at, width, height, steps, cfg, seed, or checkpoint. Even parameters with schema descriptions (e.g., preset) are not elaborated beyond what the schema provides.

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?

Description clearly states 'Generate an image using a reference image as an IP-Adapter visual/style/subject guide', which specifies the action, resource, and method. This distinguishes it from sibling tools like 'generate_image' (no reference) or 'generate_with_controlnet' (different conditioning).

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 mentions prerequisites (ComfyUI-IPAdapter-plus custom node pack and matching models) and implies usage for reference-guided generation, but does not explicitly state when to prefer this tool over alternatives like 'generate_image' or 'generate_with_controlnet'. No exclusion criteria or comparative guidance is provided.

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