Skip to main content
Glama
nanana-app

Nanana AI Image Generation Server

by nanana-app

image_to_image

Transform existing images using text prompts to create new variations. Upload 1-9 images and describe desired changes to generate modified versions with AI.

Instructions

Transform existing images based on a text prompt using Nanana AI. This operation typically takes 15-30 seconds to complete. The tool will wait for transformation to finish and return the final image URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageUrlsYesArray of image URLs to transform (1-9 images)
promptYesThe text prompt describing how to transform the images

Implementation Reference

  • Core handler function that executes the image-to-image tool logic: sends POST request to Nanana API with imageUrls and prompt, handles response and errors, converts image to base64.
    async function callImageToImage(
      apiToken: string,
      params: ImageToImageParams
    ): Promise<{ imageUrl: string; imageBase64: string; prompt: string }> {
      const response = await fetch(`${API_BASE_URL}/api/mcp/v1/image-to-image`, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${apiToken}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          imageUrls: params.imageUrls,
          prompt: params.prompt,
        }),
      });
    
      if (!response.ok) {
        const error = (await response.json().catch(() => ({}))) as {
          error?: string;
        };
        throw new Error(
          error.error || `API request failed with status ${response.status}`
        );
      }
    
      const data = (await response.json()) as { imageUrl: string; prompt: string };
    
      // Download image and convert to base64
      const imageBase64 = await imageUrlToBase64(data.imageUrl);
    
      return { imageUrl: data.imageUrl, imageBase64, prompt: data.prompt };
    }
  • TypeScript interface defining the input parameters for the image_to_image tool.
    interface ImageToImageParams {
      imageUrls: string[];
      prompt: string;
    }
  • src/index.ts:40-61 (registration)
    Tool registration object defining the name, description, and input schema for 'image_to_image'.
    const IMAGE_TO_IMAGE_TOOL: Tool = {
      name: "image_to_image",
      description:
        "Transform existing images based on a text prompt using Nanana AI. This operation typically takes 15-30 seconds to complete. The tool will wait for transformation to finish and return the final image URL.",
      inputSchema: {
        type: "object",
        properties: {
          imageUrls: {
            type: "array",
            items: { type: "string" },
            description: "Array of image URLs to transform (1-9 images)",
            minItems: 1,
            maxItems: 9,
          },
          prompt: {
            type: "string",
            description: "The text prompt describing how to transform the images",
          },
        },
        required: ["imageUrls", "prompt"],
      },
    };
  • src/index.ts:161-165 (registration)
    Registration of available tools list, including image_to_image tool, in the MCP listTools handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [TEXT_TO_IMAGE_TOOL, IMAGE_TO_IMAGE_TOOL],
      };
    });
  • MCP CallToolRequestSchema dispatch handler block that invokes the image_to_image tool handler.
    } else if (name === "image_to_image") {
      const params = args as unknown as ImageToImageParams;
      console.error(
        `[MCP] Starting image-to-image transformation: "${params.prompt}"`
      );
      const result = await callImageToImage(apiToken, params);
      console.error(`[MCP] Transformation completed: ${result.imageUrl}`);
      return {
        content: [
          {
            type: "text",
            text: `Successfully transformed image!\n\nPrompt: ${result.prompt}\n\nImage URL: ${result.imageUrl}`,
          },
        ],
      };
    } else {
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/nanana-app/mcp-server-nano-banana'

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