Skip to main content
Glama
Letz-AI
by Letz-AI

letzai_upscale_image

Increase image resolution and quality using Letz AI's upscaling technology. Provide an image ID or URL with strength settings to enhance visual details.

Instructions

Upscale an image using the LetzAI public api

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageIdNoThe unique identifier of the image to be upscaled.
imageUrlNoThe URL of the image to be upscaled. Must be a publicly available URL.
strengthYesThe strength of the upscaling process. Min. 1, Max. 3.

Implementation Reference

  • Executes the upscaling logic: validates input, calls LetzAI upscale API, polls for completion with progress updates, opens the upscaled image in browser, and returns success message.
         } else if (request.params.name === "letzai_upscale_image") {
           try {
             let { imageId, imageUrl, strength } = request.params.arguments as any;
    
             strength = parseInt(strength) || 1;
    
             let body = {};
             if (imageId) {
               body = {
                 imageId,
                 strength,
               };
             } else if (imageUrl) {
               body = {
                 imageUrl,
                 strength,
               };
             } else {
               throw new Error("Provide image ID or Image URL");
             }
    
             // Step 1: Create the image request
             const responseCreate = await axios.post(
               "https://api.letz.ai/upscale",
    
               body,
    
               {
                 headers: {
                   Authorization: `Bearer ${process.env.LETZAI_API_KEY}`,
                 },
               }
             );
    
             let imageFinished = false;
             let imageVersions: {
               original: string;
               "96x96": string;
               "240x240": string;
               "640x640": string;
               "1920x1920": string;
             } | null = null;
    
             let upscaleId = responseCreate.data.id;
    
             // Step 2: Poll for image creation status
             while (!imageFinished) {
               await new Promise((resolve) => setTimeout(resolve, 5000)); // Wait before checking again
    
               const responseImage = await axios.get(
                 `https://api.letz.ai/upscale/${upscaleId}`,
                 {
                   headers: {
                     Authorization: `Bearer ${process.env.LETZAI_API_KEY}`,
                   },
                 }
               );
    
               if (responseImage.data.status != "ready") {
                 // Send a progress notification (through stdout for Stdio transport)
                 console.log(
                   JSON.stringify({
                     jsonrpc: "2.0",
                     method: "progress_update",
                     params: {
                       message: `Image is still being processed. Progress: ${responseImage.data.progress}%`,
                     },
                   })
                 );
               } else {
                 imageFinished = true;
                 imageVersions = responseImage.data.imageVersions;
               }
             }
    
             // Convert the image to Base64 after processing is complete
             /*  const imageBase64 = convertImageUrlToBase64(
               imageVersions?.["640x640"] as string
             );
    */
             // Open the image in browser
             open(imageVersions?.original as string);
    
             // Return the response to the client
             return {
               content: [
                 {
                   type: "text",
                   text: `Image upscaled successfully!\nThe image has been opened in your default browser.\n\n Image URL: ${imageVersions?.original}\n\nYou can also click the URL above to view the image again.`,
                 },
               ],
             };
           } catch (err: any) {
             return {
               content: [
                 {
                   type: "text",
                   text: `Error happened: ${err.toString()}`,
                 },
               ],
             };
           }
         }
  • Defines the tool schema including name, description, and input schema with properties for imageId, imageUrl, and strength.
    export const upscaleImageTool = {
      name: "letzai_upscale_image",
      description: "Upscale an image using the LetzAI public api",
      inputSchema: {
        type: "object",
        properties: {
          imageId: {
            type: "string",
            description: "The unique identifier of the image to be upscaled.",
          },
          imageUrl: {
            type: "string",
            description:
              "The URL of the image to be upscaled. Must be a publicly available URL.",
          },
          strength: {
            type: "number",
            default: 1,
            description: "The strength of the upscaling process. Min. 1, Max. 3.",
          },
        },
        required: ["strength"],
      },
    };
  • src/tools.ts:13-17 (registration)
    Registers the upscaleImageTool in the list of available tools for the MCP server.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [createImageTool, upscaleImageTool],
      };
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions using a public API but doesn't disclose critical traits like authentication requirements, rate limits, cost implications, error handling, or what happens to the original image. For a tool that modifies content with no annotation coverage, this leaves significant gaps in understanding its 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 a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a straightforward tool and front-loads the essential information. Every word earns its place, making it maximally concise.

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?

Given the tool modifies images (implied mutation), has no annotations, and no output schema, the description is incomplete. It doesn't explain what 'upscale' means practically, what format/resolution results are expected, whether the operation is reversible, or what happens if both imageId and imageUrl are provided. For a 3-parameter tool with no structured safety or output information, more context is needed.

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 three parameters thoroughly. The description adds no additional meaning about parameters beyond what's in the schema. It doesn't explain the relationship between imageId and imageUrl, or provide context about strength values. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Upscale') and resource ('an image') using the LetzAI public API. It distinguishes from the sibling tool 'letzai_create_image' by focusing on upscaling existing images rather than creating new ones. However, it doesn't specify the exact upscaling method or output characteristics, keeping it at a 4 rather than a 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, limitations, or comparison with the sibling 'letzai_create_image' tool. The agent must infer usage from the tool name and parameters alone, which is insufficient for clear decision-making.

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/Letz-AI/letzai-mcp'

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