Skip to main content
Glama
ilhankilic

YaparAI MCP Server

by ilhankilic

transform_image

Modify an existing image with a text prompt to create a new variation. Supports style transfer, enhancements, and custom modifications.

Instructions

Transform an existing image using AI (image-to-image).

Uses the source image as a reference and applies the prompt to create a new variation. Great for style transfer, modifications, and enhancements. Cost: ~6 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescription of the desired transformation
image_urlYesURL of the source image to transform
negative_promptNoThings to avoid in the output
widthNoOutput width in pixels (64-2048, default 512)
heightNoOutput height in pixels (64-2048, default 512)
styleNoStyle preset (realistic, anime, cinematic, artistic)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that executes the transform_image tool logic. Calls YaparAIClient.generate() with 'img2img' mode and YaparAIClient.wait_for_result() to produce the result.
    async def transform_image(
        prompt: str,
        image_url: str,
        negative_prompt: str = "",
        width: int = 512,
        height: int = 512,
        style: Literal["realistic", "anime", "cinematic", "artistic"] | None = None,
    ) -> dict:
        """
        Transform an existing image using AI (image-to-image).
    
        Uses the source image as a reference and applies the prompt to create
        a new variation. Great for style transfer, modifications, and enhancements.
        Cost: ~6 credits.
    
        Args:
            prompt: Description of the desired transformation
            image_url: URL of the source image to transform
            negative_prompt: Things to avoid in the output
            width: Output width in pixels (64-2048, default 512)
            height: Output height in pixels (64-2048, default 512)
            style: Style preset (realistic, anime, cinematic, artistic)
    
        Returns:
            Dict with image_url, job_id, credits_used, and balance_remaining.
        """
        client = YaparAIClient()
        job = await client.generate({
            "type": "image",
            "mode": "img2img",
            "prompt": prompt,
            "negative_prompt": negative_prompt,
            "image_url": image_url,
            "width": width,
            "height": height,
            "style": style,
        })
    
        result = await client.wait_for_result(job["job_id"], timeout=60)
        return {
            "status": "success",
            "image_url": result.get("result_url"),
            "job_id": result.get("job_id"),
            "credits_used": job.get("credits_used"),
            "balance_remaining": job.get("balance_remaining"),
        }
  • Registration of transform_image as an MCP tool via FastMCP's @tool decorator (using mcp.tool()).
    mcp.tool(transform_image)
  • YaparAIClient.generate() is the HTTP helper that sends the image-to-image request payload to the API.
    async def generate(self, request: dict) -> dict:
        """Start a generation job."""
        return await self._request("POST", "/v1/public/generate", json=request)
  • YaparAIClient.wait_for_result() polls the job status until completion; used by transform_image to get the final result.
    async def wait_for_result(
        self,
        job_id: str,
        timeout: int = 120,
        poll_interval: int = 3,
    ) -> dict:
        """Poll job status until completed or timeout."""
        elapsed = 0
        while elapsed < timeout:
            job = await self.get_job(job_id)
            status = job.get("status", "")
            if status == "succeeded":
                return job
            if status == "failed":
                error = job.get("error_message") or job.get("error") or "Unknown error"
                raise RuntimeError(f"Generation failed: {error}")
            await asyncio.sleep(poll_interval)
            elapsed += poll_interval
        raise TimeoutError(
            f"Job {job_id} is still processing after {timeout}s. "
            f"Use get_job_status('{job_id}') to check later."
        )
Behavior3/5

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

With no annotations, the description bears full burden for behavioral disclosure. It states the tool uses the source image as reference and applies a prompt, and notes cost. It lacks explicit statements about side effects (e.g., whether the source is modified) or output behavior, though output schema exists.

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 three sentences, each serving a purpose: defining the action, explaining the process with examples, and noting cost. No unnecessary words.

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?

The description covers the main use case and cost, and the output schema exists for return values. With 6 parameters (2 required), it provides sufficient context for an agent to understand when and how to use the tool.

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 coverage is 100%, so baseline is 3. The description adds context like 'style transfer' which relates to the style parameter, but does not provide additional semantic details beyond what the input schema already describes.

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 'Transform an existing image using AI (image-to-image)', using a specific verb and resource. It mentions style transfer, modifications, and enhancements, distinguishing it from sibling tools like generate_image (creates from scratch) and remove_background (specific removal).

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 provides context for use ('Great for style transfer, modifications, and enhancements'), implying appropriate scenarios. However, it does not explicitly exclude inappropriate uses or compare with siblings like generate_image or swap_face, which could be alternatives for certain tasks.

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/ilhankilic/yaparai-mcp'

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