Skip to main content
Glama

generate_asset

Create RPG Maker MZ game assets including characters, faces, tilesets, and battle backgrounds using AI generation with text prompts.

Instructions

Generate RPG Maker MZ asset using Gemini 2.5 Flash (characters, faces, tilesets, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoGemini API key (optional, uses GEMINI_API_KEY env var if not provided)
asset_typeYesType of asset to generate
filenameYesFilename for the generated asset (with extension)
project_pathYesPath to the RPG Maker MZ project directory
promptYesDescription of the asset to generate

Implementation Reference

  • Input schema definition for the 'generate_asset' MCP tool, specifying parameters like project_path, asset_type, prompt, filename, and optional api_key.
    name: "generate_asset", description: "Generate RPG Maker MZ asset using Gemini 2.5 Flash (characters, faces, tilesets, etc.)", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to the RPG Maker MZ project directory", }, asset_type: { type: "string", enum: ["character", "face", "tileset", "battleback", "enemy", "sv_actor", "picture"], description: "Type of asset to generate", }, prompt: { type: "string", description: "Description of the asset to generate", }, filename: { type: "string", description: "Filename for the generated asset (with extension)", }, api_key: { type: "string", description: "Gemini API key (optional, uses GEMINI_API_KEY env var if not provided)", }, }, required: ["project_path", "asset_type", "prompt", "filename"], }, },
  • MCP tool dispatcher handler for 'generate_asset' that constructs AssetGenerationRequest and calls generateAssetWithGemini.
    case "generate_asset": { const request: AssetGenerationRequest = { projectPath: args.project_path as string, assetType: args.asset_type as any, prompt: args.prompt as string, filename: args.filename as string, apiKey: args.api_key as string | undefined, }; const result = await generateAssetWithGemini(request); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
  • Core implementation of asset generation using Gemini API: validates input, builds enhanced prompt, calls API, extracts image data, saves to project directory.
    export async function generateAssetWithGemini(request: AssetGenerationRequest): Promise<{ success: boolean; path?: string; error?: string }> { try { // Validate inputs await validateProjectPath(request.projectPath); Validator.requireEnum( request.assetType, "assetType", ["character", "face", "tileset", "battleback", "enemy", "sv_actor", "picture"] as const ); Validator.requireString(request.prompt, "prompt"); Validator.requireString(request.filename, "filename"); const apiKey = validateGeminiAPIKey(request.apiKey); await Logger.info("Generating asset with Gemini", { projectPath: request.projectPath, assetType: request.assetType, filename: request.filename }); const specs = ASSET_SPECS[request.assetType]; const enhancedPrompt = buildPrompt(request.assetType, request.prompt, specs); // Call Gemini 2.5 Flash API with image generation const response = await APIHelper.fetchWithRetry( `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent?key=${apiKey}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ contents: [{ parts: [{ text: enhancedPrompt }] }], generationConfig: { temperature: 1.0, topK: 40, topP: 0.95, maxOutputTokens: 8192, } }) } ); if (!response.ok) { return { success: false, error: `API error: ${response.statusText}` }; } const data = await response.json(); // Extract image data (assuming Gemini returns base64 or URL) // Note: Gemini 2.5 Flash may not support direct image generation // This is a placeholder for the actual implementation const imageData = extractImageData(data); if (!imageData) { return { success: false, error: "No image data in response" }; } // Save image to appropriate directory const assetPath = getAssetPath(request.projectPath, request.assetType); await fs.mkdir(assetPath, { recursive: true }); const fullPath = path.join(assetPath, request.filename); await saveImage(fullPath, imageData); return { success: true, path: fullPath }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • TypeScript interface defining the input parameters for asset generation, matching the MCP tool schema.
    export interface AssetGenerationRequest { projectPath: string; assetType: "character" | "face" | "tileset" | "battleback" | "enemy" | "sv_actor" | "picture"; prompt: string; filename: string; apiKey?: string; }
  • Import of the generateAssetWithGemini handler and AssetGenerationRequest type from asset-generation.ts.
    generateAssetWithGemini,

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/ShunsukeHayashi/rpgmaker-mz-mcp'

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