Skip to main content
Glama

upload_image

Upload an image using a public URL or base64 data to get a hosted URL that serves as photo_url in RendrKit templates.

Instructions

Upload an image to get a hosted URL that can be used as photo_url in templates. Provide either a public URL to re-upload or base64-encoded image data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoPublic URL of an image to download and re-upload
base64NoBase64-encoded image data
mime_typeNoMIME type of the image (image/jpeg, image/png, image/webp). Required when using base64.

Implementation Reference

  • The registerUploadImageTool function that registers the 'upload_image' tool on the MCP server. The handler (lines 31-65) accepts url, base64, and mime_type inputs, calls client.uploadImage(), and returns formatted text with the hosted URL, filename, size, and type.
    export function registerUploadImageTool(
      server: McpServer,
      client: RendrKitClient,
    ): void {
      server.registerTool(
        "upload_image",
        {
          description:
            "Upload an image to get a hosted URL that can be used as photo_url in templates. Provide either a public URL to re-upload or base64-encoded image data.",
          inputSchema: {
            url: z
              .string()
              .optional()
              .describe("Public URL of an image to download and re-upload"),
            base64: z
              .string()
              .optional()
              .describe("Base64-encoded image data"),
            mime_type: z
              .string()
              .optional()
              .describe(
                "MIME type of the image (image/jpeg, image/png, image/webp). Required when using base64.",
              ),
          },
        },
        async ({ url, base64, mime_type }) => {
          try {
            const result = await client.uploadImage({ url, base64, mimeType: mime_type });
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: [
                    `Image uploaded successfully!`,
                    ``,
                    `URL: ${result.url}`,
                    `Filename: ${result.filename}`,
                    `Size: ${result.size} bytes`,
                    `Type: ${result.mimeType}`,
                    ``,
                    `Use this URL as image_url or photo_url in generate_image.`,
                  ].join("\n"),
                },
              ],
            };
          } catch (error) {
            const message =
              error instanceof Error ? error.message : String(error);
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Failed to upload image: ${message}`,
                },
              ],
              isError: true,
            };
          }
        },
      );
    }
  • Input schema defined via Zod: url (optional string), base64 (optional string), mime_type (optional string, required when using base64).
    inputSchema: {
      url: z
        .string()
        .optional()
        .describe("Public URL of an image to download and re-upload"),
      base64: z
        .string()
        .optional()
        .describe("Base64-encoded image data"),
      mime_type: z
        .string()
        .optional()
        .describe(
          "MIME type of the image (image/jpeg, image/png, image/webp). Required when using base64.",
        ),
    },
  • UploadResult type: url (string), filename (string), size (number), mimeType (string).
    export interface UploadResult {
      url: string;
      filename: string;
      size: number;
      mimeType: string;
    }
  • src/server.ts:8-8 (registration)
    Import of registerUploadImageTool from the upload-image module.
    import { registerUploadImageTool } from "./tools/upload-image.js";
  • src/server.ts:23-23 (registration)
    Registration call: registerUploadImageTool(server, client) invoked during server creation.
    registerUploadImageTool(server, client);
  • The RendrKitClient.uploadImage() method that POSTs to /api/v1/upload with url, base64, and mimeType fields and returns UploadResult.
    async uploadImage(params: UploadImageParams): Promise<UploadResult> {
      const body: Record<string, unknown> = {};
      if (params.url) body.url = params.url;
      if (params.base64) body.base64 = params.base64;
      if (params.mimeType) body.mimeType = params.mimeType;
      return this.request<UploadResult>("POST", "/api/v1/upload", body);
    }
  • UploadImageParams interface defining optional url, base64, and mimeType properties.
    export interface UploadImageParams {
      url?: string;
      base64?: string;
      mimeType?: string;
    }
Behavior2/5

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

No annotations, so full burden on description. Describes upload action but omits behavioral details like destructive potential, authentication requirements, rate limits, file size restrictions, or whether the operation is reversible. The description provides basic function but lacks sufficient behavioral disclosure.

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?

Two sentences conveying purpose, outcome, and input options with no redundancy. Every word contributes essential information.

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?

Complete enough for a straightforward upload tool: describes return value (hosted URL), input methods, and usage context. Lacks details on limits or security but adequate given schema coverage and no output schema. Minor gaps prevent a perfect score.

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

Parameters4/5

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

Schema coverage is 100%, baseline 3. Description adds value by clarifying the choice between URL and base64, and that mime_type is required for base64. This integrates the parameter information into a coherent usage pattern beyond individual schema descriptions.

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?

Clearly states the verb 'upload' and resource 'image', with specific outcome 'get a hosted URL that can be used as photo_url in templates'. Distinguishes from sibling tools like generate_image (creates new images) and get_image (retrieves).

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?

Implies when to use (to get a hosted URL for templates) but provides no explicit when-not-to-use or comparison with alternatives. The context of siblings suggests differentiation but no direct guidance.

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/vbiff/rendr-kit'

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