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

letzai_create_image

Generate custom images from text prompts using AI, with adjustable dimensions, quality, creativity levels, and generation modes.

Instructions

Create an image using the LetzAI public api

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesImage prompt to generate a new image. Can also include @tag to generate an image using a model from the LetzAi Platform
widthNoWidth of the image should be between 520 and 2160 max pixels. Default is 1600.
heightNoHeight of the image should be between 520 and 2160 max pixels. Default is 1600.
qualityNoDefines how many steps the generation should take. Higher is slower, but generally better quality. Min: 1, Default: 2, Max: 5
creativityNoDefines how strictly the prompt should be respected. Higher Creativity makes the images more artificial. Lower makes it more photorealistic. Min: 1, Default: 2, Max: 5
hasWatermarkNoDefines whether to set a watermark or not. Default is true
systemVersionNoAllowed values: 2, 3. UseLetzAI V2, or V3 (newest).
modeNoSelect one of the different modes that offer different generation settings. Allowed values: default, sigma, turbo. Default is slow but high quality. Sigma is faster and great for close ups. Turbo is fastest, but lower quality.turbo

Implementation Reference

  • Main execution logic for the letzai_create_image tool. Parses arguments, calls LetzAI API to generate image, polls status with progress updates via console, opens image in browser, returns text content with URL.
         if (request.params.name === "letzai_create_image") {
           try {
             let {
               prompt,
               width,
               height,
               quality,
               creativity,
               hasWatermark,
               systemVersion,
               mode,
             } = request.params.arguments as any;
    
             mode = !mode || !mode.includes(mode || "") ? "turbo" : mode;
             width = parseInt(width) || 1600;
             height = parseInt(height) || 1600;
             quality = parseInt(quality) || 2;
             creativity = parseInt(creativity) || 2;
             systemVersion = parseInt(systemVersion) || 3;
             hasWatermark =
               typeof hasWatermark === "boolean" ? hasWatermark : false;
    
             // Step 1: Create the image request
             const responseCreate = await axios.post(
               "https://api.letz.ai/images",
               {
                 prompt,
                 width,
                 height,
                 quality,
                 creativity,
                 hasWatermark,
                 systemVersion,
                 mode,
               },
               {
                 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 imageId = 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/images/${imageId}`,
                 {
                   headers: {
                     Authorization: `Bearer ${process.env.LETZAI_API_KEY}`,
                   },
                 }
               );
    
               if (responseImage.data.progress < 100) {
                 // 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 generated 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()}`,
                 },
               ],
             };
           }
         } else if (request.params.name === "letzai_upscale_image") {
  • Input schema and metadata for the letzai_create_image tool, defining parameters like prompt, dimensions, quality, and mode.
    export const createImageTool = {
      name: "letzai_create_image",
      description: "Create an image using the LetzAI public api",
      inputSchema: {
        type: "object",
        properties: {
          prompt: {
            type: "string",
            description:
              "Image prompt to generate a new image. Can also include @tag to generate an image using a model from the LetzAi Platform",
          },
          width: {
            type: "number",
            default: 1600,
            description:
              "Width of the image should be between 520 and 2160 max pixels. Default is 1600.",
          },
          height: {
            type: "number",
            default: 1600,
            description:
              "Height of the image should be between 520 and 2160 max pixels. Default is 1600.",
          },
          quality: {
            type: "number",
            default: 2,
            description:
              "Defines how many steps the generation should take. Higher is slower, but generally better quality. Min: 1, Default: 2, Max: 5",
          },
          creativity: {
            type: "number",
            default: 2,
            description:
              "Defines how strictly the prompt should be respected. Higher Creativity makes the images more artificial. Lower makes it more photorealistic. Min: 1, Default: 2, Max: 5",
          },
          hasWatermark: {
            type: "boolean",
            default: true,
            description:
              "Defines whether to set a watermark or not. Default is true",
          },
          systemVersion: {
            type: "number",
            default: 3,
            description: "Allowed values: 2, 3. UseLetzAI V2, or V3 (newest).",
          },
          mode: {
            type: "string",
            default: "turbo",
            enum: modes,
            description:
              "Select one of the different modes that offer different generation settings. Allowed values: default, sigma, turbo. Default is slow but high quality. Sigma is faster and great for close ups. Turbo is fastest, but lower quality.",
          },
        },
        required: ["prompt"],
      },
    };
  • src/tools.ts:13-17 (registration)
    Registers the letzai_create_image tool (as createImageTool) in the list of available tools returned by ListToolsRequestSchema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [createImageTool, upscaleImageTool],
      };
    });
  • Helper constant defining available modes for image generation, used in schema enum and handler validation.
    export const modes = ["default", "turbo", "sigma"];
  • src/tools.ts:9-9 (registration)
    Import of the createImageTool schema and modes helper into the main tools file.
    import { createImageTool, modes } from "./tools/createImage.js";
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action. It doesn't cover authentication needs, rate limits, response format, error handling, or any side effects (e.g., whether creation is idempotent or has costs). This leaves significant gaps for an AI agent to understand 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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse while avoiding redundancy or fluff.

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 complexity of an 8-parameter image generation tool with no annotations and no output schema, the description is insufficient. It lacks details on return values, error conditions, usage constraints, and how it integrates with the sibling tool, leaving the agent with incomplete operational context.

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?

The schema description coverage is 100%, providing detailed documentation for all 8 parameters. The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline score of 3 without compensating or enhancing parameter understanding.

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 ('create an image') and the target resource ('using the LetzAI public api'), making the purpose immediately understandable. It distinguishes from the sibling tool 'letzai_upscale_image' by focusing on generation rather than enhancement, though it doesn't explicitly contrast them.

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 or any contextual prerequisites. It mentions the LetzAI public API but doesn't specify use cases, limitations, or when to choose this over other image generation tools.

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