Skip to main content
Glama
stvlynn

Volcengine Image Generation MCP Server

by stvlynn

generate_image

Create images from text descriptions using Volcengine's AI technology, with customizable parameters for size, style, and output format.

Instructions

Generate images using Volcengine's text-to-image API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesText prompt for image generation (max 1000 characters)
modelNoModel to use for image generationdoubao-seedream-3-0-t2i-250415
sizeNoImage size dimensions1024x1024
seedNoRandom seed for reproducible results (-1 for random)
guidance_scaleNoHow closely to follow the prompt (1-10)
watermarkNoWhether to add watermark to generated images
response_formatNoFormat for returned image dataurl

Implementation Reference

  • The primary handler function for the 'generate_image' tool. Validates input arguments using Zod schema, prepares the request, calls the Volcengine API, and returns formatted success/error response.
    async generateImage(args: VolcengineImageGenerationToolArgs) {
      try {
        const validatedArgs = generateImageSchema.parse(args);
        
        const request = {
          model: validatedArgs.model,
          prompt: validatedArgs.prompt,
          response_format: validatedArgs.response_format,
          size: validatedArgs.size,
          seed: validatedArgs.seed,
          guidance_scale: validatedArgs.guidance_scale,
          watermark: validatedArgs.watermark,
        };
    
        const response = await this.api.generateImage(request);
    
        return {
          success: true,
          data: {
            model: response.model,
            created: response.created,
            images: response.data,
            usage: response.usage,
          },
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error occurred',
        };
      }
    }
  • Zod schema used for input validation of the 'generate_image' tool arguments.
    export const generateImageSchema = z.object({
      prompt: z.string().min(1, 'Prompt is required').max(1000, 'Prompt too long'),
      model: z.string().default(DEFAULT_MODEL),
      size: z.enum(SUPPORTED_SIZES).default(DEFAULT_SIZE),
      seed: z.number().int().min(-1).max(2147483647).optional(),
      guidance_scale: z.number().min(1).max(10).optional(),
      watermark: z.boolean().default(true),
      response_format: z.enum(['url', 'b64_json']).default(DEFAULT_RESPONSE_FORMAT),
    });
  • src/tools.ts:61-110 (registration)
    Tool definition method returning the MCP tool specification for 'generate_image', including name, description, and input schema. Used in listTools response.
    getToolDefinition() {
      return {
        name: 'generate_image',
        description: 'Generate images using Volcengine\'s text-to-image API',
        inputSchema: {
          type: 'object',
          properties: {
            prompt: {
              type: 'string',
              description: 'Text prompt for image generation (max 1000 characters)',
            },
            model: {
              type: 'string',
              description: 'Model to use for image generation',
              default: DEFAULT_MODEL,
            },
            size: {
              type: 'string',
              description: 'Image size dimensions',
              enum: SUPPORTED_SIZES,
              default: DEFAULT_SIZE,
            },
            seed: {
              type: 'number',
              description: 'Random seed for reproducible results (-1 for random)',
              minimum: -1,
              maximum: 2147483647,
            },
            guidance_scale: {
              type: 'number',
              description: 'How closely to follow the prompt (1-10)',
              minimum: 1,
              maximum: 10,
            },
            watermark: {
              type: 'boolean',
              description: 'Whether to add watermark to generated images',
              default: true,
            },
            response_format: {
              type: 'string',
              description: 'Format for returned image data',
              enum: ['url', 'b64_json'],
              default: DEFAULT_RESPONSE_FORMAT,
            },
          },
          required: ['prompt'],
        },
      };
    }
  • src/index.ts:47-82 (registration)
    Dispatch logic in MCP callTool request handler: checks for 'generate_image' tool name and invokes the handler, formats MCP response.
    if (name === 'generate_image') {
      try {
        const result = await this.imageTools.generateImage(args);
        
        if (result.success) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(result.data, null, 2),
              },
            ],
          };
        } else {
          return {
            content: [
              {
                type: 'text',
                text: `Error: ${result.error}`,
              },
            ],
            isError: true,
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Low-level helper that makes the HTTP POST request to Volcengine's image generation API endpoint.
    async generateImage(request: VolcengineImageGenerationRequest): Promise<VolcengineImageGenerationResponse> {
      try {
        const response = await this.client.post<VolcengineImageGenerationResponse>(
          '/images/generations',
          request
        );
        
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          const status = error.response?.status;
          const message = error.response?.data?.error?.message || error.message;
          
          if (status === 401) {
            throw new Error('Invalid API key or unauthorized access');
          } else if (status === 429) {
            throw new Error('Rate limit exceeded. Please try again later.');
          } else if (status === 400) {
            throw new Error(`Invalid request: ${message}`);
          } else {
            throw new Error(`API request failed: ${message}`);
          }
        }
        
        throw new Error(`Unknown error: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
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. It mentions the API provider but doesn't describe rate limits, authentication requirements, error handling, what happens when generation fails, or the nature of the output (e.g., image format, quality constraints). This leaves significant gaps for a generative tool.

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 any unnecessary words. It's perfectly front-loaded and wastes no space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a generative image tool with 7 parameters and no output schema, the description is minimal. While concise, it doesn't compensate for the lack of annotations or output schema by explaining what kind of image data is returned, typical use cases, or limitations. The schema handles parameter documentation well, but overall context remains incomplete.

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 description adds no parameter-specific information beyond what's already in the schema, which has 100% coverage with detailed descriptions for all 7 parameters. This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't provide additional context like typical prompt structures or model selection guidance.

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 ('Generate images') and specifies the resource ('using Volcengine's text-to-image API'), making the purpose immediately understandable. However, since there are no sibling tools mentioned, it doesn't need to distinguish from alternatives, so it can't achieve a perfect 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, prerequisites, or typical use cases. It simply states what the tool does without any contextual usage information.

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/stvlynn/Volcengine-Image-MCP'

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