Skip to main content
Glama

virtual_try_on

Apply AI-powered virtual clothing try-on to person images. Upload a person image and clothing items to visualize complete outfits before purchase.

Instructions

Apply virtual clothing try-on to a person image using AI. Upload a person image and up to 5 clothing items to see how they would look wearing those clothes. Supports both single and multiple clothing combinations for complete outfit visualization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
person_image_urlYesURL of the person image to try clothes on
cloth_image_urlsYesArray of clothing image URLs (1-5 items). Multiple items will be combined into a complete outfit
model_nameNoModel version to use (default: kolors-virtual-try-on-v1.5)

Implementation Reference

  • MCP server handler for 'virtual_try_on' tool: parses arguments, calls KlingClient.virtualTryOn, returns task ID and instructions
    case 'virtual_try_on': {
      const tryOnRequest: VirtualTryOnRequest = {
        person_image_url: args.person_image_url as string,
        cloth_image_urls: args.cloth_image_urls as string[],
        model_name: (args.model_name as 'kolors-virtual-try-on-v1' | 'kolors-virtual-try-on-v1.5') || 'kolors-virtual-try-on-v1.5',
      };
    
      const result = await klingClient.virtualTryOn(tryOnRequest);
      
      return {
        content: [
          {
            type: 'text',
            text: `Virtual try-on started successfully!\nTask ID: ${result.task_id}\n\nThe AI is processing your virtual try-on with ${tryOnRequest.cloth_image_urls.length} clothing item(s).\nUse the check_video_status tool with this task ID to check the progress and retrieve the try-on result video.`,
          },
        ],
      };
    }
  • Input schema and metadata for the 'virtual_try_on' tool, including properties for person_image_url, cloth_image_urls, and model_name
      name: 'virtual_try_on',
      description: 'Apply virtual clothing try-on to a person image using AI. Upload a person image and up to 5 clothing items to see how they would look wearing those clothes. Supports both single and multiple clothing combinations for complete outfit visualization.',
      inputSchema: {
        type: 'object',
        properties: {
          person_image_url: {
            type: 'string',
            description: 'URL of the person image to try clothes on',
          },
          cloth_image_urls: {
            type: 'array',
            items: {
              type: 'string',
            },
            description: 'Array of clothing image URLs (1-5 items). Multiple items will be combined into a complete outfit',
            minItems: 1,
            maxItems: 5,
          },
          model_name: {
            type: 'string',
            enum: ['kolors-virtual-try-on-v1', 'kolors-virtual-try-on-v1.5'],
            description: 'Model version to use (default: kolors-virtual-try-on-v1.5)',
          },
        },
        required: ['person_image_url', 'cloth_image_urls'],
      },
    },
  • Core implementation of virtual try-on: validates inputs, processes image URLs, makes POST request to Kling API /v1/virtual-try-on endpoint
    async virtualTryOn(request: VirtualTryOnRequest): Promise<{ task_id: string }> {
      const path = '/v1/virtual-try-on';
      
      if (request.cloth_image_urls.length === 0) {
        throw new Error('At least one clothing image URL is required');
      }
      
      if (request.cloth_image_urls.length > 5) {
        throw new Error('Maximum 5 clothing items allowed per request');
      }
      
      // Process all image URLs
      const person_image_url = await this.processImageUrl(request.person_image_url);
      const cloth_image_urls = await Promise.all(
        request.cloth_image_urls.map(url => this.processImageUrl(url))
      );
      
      const body = {
        model_name: request.model_name || 'kolors-virtual-try-on-v1.5',
        person_image_url: person_image_url!,
        cloth_image_urls: cloth_image_urls.filter(url => url !== undefined),
      };
    
      try {
        const response = await this.axiosInstance.post(path, body);
        return response.data.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Kling API error: ${error.response?.data?.message || error.message}`);
        }
        throw error;
      }
    }
  • TypeScript interface defining the VirtualTryOnRequest type used by the handler
    export interface VirtualTryOnRequest {
      person_image_url: string;
      cloth_image_urls: string[];
      model_name?: 'kolors-virtual-try-on-v1' | 'kolors-virtual-try-on-v1.5';
    }
  • src/index.ts:467-469 (registration)
    Registers the TOOLS array (which includes virtual_try_on) for the ListToolsRequest handler
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS,
    }));
Behavior2/5

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

No annotations are provided, so the description carries the full burden. While it mentions the core functionality, it fails to disclose critical behavioral traits such as required image formats, processing time, rate limits, authentication needs, or what happens with invalid inputs. For a tool with no annotation coverage, this leaves significant gaps in understanding its operational behavior.

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?

The description is front-loaded with the core purpose in the first sentence, followed by specific details in the second. Both sentences earn their place by clarifying the upload process and outfit capabilities without any wasted words, making it efficient and well-structured.

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

Completeness3/5

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

Given the tool's moderate complexity (3 parameters, no output schema, and no annotations), the description is adequate for basic understanding but incomplete. It covers what the tool does but lacks details on behavioral aspects like error handling or output format, which are crucial for effective use without structured annotations or output schema.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by mentioning 'up to 5 clothing items' and 'complete outfit visualization,' which slightly reinforces the cloth_image_urls parameter's purpose but doesn't provide additional syntax or format details. Baseline 3 is appropriate when the schema does the heavy lifting.

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 specific action ('Apply virtual clothing try-on'), resource ('to a person image using AI'), and scope ('upload a person image and up to 5 clothing items'). It distinguishes this tool from siblings like generate_image or apply_video_effect by focusing on clothing visualization rather than general image/video generation or effects.

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 implies usage for outfit visualization with single or multiple clothing items, but provides no explicit guidance on when to use this tool versus alternatives like generate_image for creating images from scratch. It mentions the capability but lacks context about prerequisites or exclusions.

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/199-mcp/mcp-kling'

If you have feedback or need assistance with the MCP directory API, please join our Discord server