Skip to main content
Glama

images

Generate an image from a text prompt. Choose aspect ratio: 1:1, 16:9, 9:16, or 4:3.

Instructions

Generate an image from a text prompt. Cost: 3 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesText description of the image to generate
aspect_ratioNo1:1, 16:9, 9:16, or 4:31:1

Implementation Reference

  • Schema definition for the 'images' tool, defining its name, description, and input schema (prompt and optional aspect_ratio) as part of CAPABILITIES array.
    {
      name: "images",
      description: "Generate an image from a text prompt. Cost: 3 credits.",
      inputSchema: {
        prompt: z.string().describe("Text description of the image to generate"),
        aspect_ratio: z.string().optional().default("1:1").describe("1:1, 16:9, 9:16, or 4:3"),
      },
    },
  • src/index.ts:246-259 (registration)
    Registration loop that iterates over CAPABILITIES (including 'images') and registers each as an MCP tool via server.registerTool().
    // Register each capability as an MCP tool
    for (const cap of CAPABILITIES) {
      // Cast inputSchema to avoid TS2589 (excessively deep type instantiation from Zod chains)
      server.registerTool(
        cap.name,
        {
          description: cap.description,
          inputSchema: cap.inputSchema as any,
        },
        async (args: any): Promise<CallToolResult> => {
          return callSuprsonic(cap.name, args as Record<string, unknown>);
        },
      );
    }
  • The handler function (async callback) for all tools including 'images'. Calls callSuprsonic(cap.name, args) to dispatch the request.
    async (args: any): Promise<CallToolResult> => {
      return callSuprsonic(cap.name, args as Record<string, unknown>);
    },
  • Helper function callSuprsonic that makes HTTP requests to the Suprsonic REST API with the capability name and params. Used by all tool handlers including 'images'.
    async function callSuprsonic(capability: string, params: Record<string, unknown>): Promise<CallToolResult> {
      if (!API_KEY) {
        return {
          content: [{ type: "text", text: "Error: SUPRSONIC_API_KEY environment variable is not set. Get your key at https://suprsonic.ai/app/apis" }],
          isError: true,
        };
      }
    
      try {
        const resp = await fetch(`${BASE_URL}/v1/agent`, {
          method: "POST",
          headers: {
            "Authorization": `Bearer ${API_KEY}`,
            "Content-Type": "application/json",
          },
          body: JSON.stringify({ capability, params }),
        });
    
        const result = await resp.json() as any;
    
        // Handle non-envelope responses (401, 429, etc. return {"detail": ...})
        if (result.detail && result.success === undefined) {
          const msg = typeof result.detail === "object" ? (result.detail.title || result.detail.detail || JSON.stringify(result.detail)) : String(result.detail);
          return {
            content: [{ type: "text", text: `Error (HTTP ${resp.status}): ${msg}` }],
            isError: true,
          };
        }
    
        if (!result.success) {
          const errMsg = result.error?.detail || result.error?.title || "Request failed";
          return {
            content: [{ type: "text", text: `Error: ${errMsg}` }],
            isError: true,
          };
        }
    
        const text = JSON.stringify(result.data, null, 2);
        const meta = result.metadata
          ? `\n\n[Provider: ${(result.metadata as any).provider_used || "unknown"}, ${(result.metadata as any).response_time_ms || 0}ms, ${result.credits_used || 0} credits]`
          : "";
    
        return {
          content: [{ type: "text", text: text + meta }],
        };
      } catch (err) {
        return {
          content: [{ type: "text", text: `Network error: ${err instanceof Error ? err.message : String(err)}` }],
          isError: true,
        };
      }
Behavior2/5

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

With no annotations, the description should disclose behavioral traits. It mentions the cost of 3 credits, which is good, but does not cover rate limits, safety filters, or response format, leaving significant gaps for an LLM evaluating tool usage.

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 extremely concise with two short sentences, no redundancy, and all information is front-loaded. Every word adds value.

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?

The tool is simple but lacks output schema; the description does not explain what the tool returns (e.g., image URL or base64). Additionally, there is no mention of limitations or common errors, leaving the agent underinformed.

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 input schema already fully describes both parameters. The description adds no extra parameter information beyond the cost, so a baseline score of 3 is appropriate.

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 that the tool generates an image from a text prompt, using a specific verb and resource. It distinguishes itself from sibling tools like bg-remove (image editing) and screenshot (capturing existing images).

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?

The description implies use for text-to-image generation, but does not explicitly state when to use this tool versus alternatives like bg-remove or screenshot. No exclusions or context for choosing this tool are provided.

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/O-mega-Enterprise/suprsonic-mcp'

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