describe_asset
Analyze RPG Maker MZ assets to generate detailed descriptions using AI, helping developers understand and document existing game resources for better project management.
Instructions
Analyze and describe an existing RPG Maker MZ asset using Gemini 2.5 Flash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | Gemini API key (optional) | |
| asset_type | Yes | Type of asset | |
| filename | Yes | Filename of the asset to analyze | |
| project_path | Yes | Path to the RPG Maker MZ project directory |
Implementation Reference
- src/asset-generation.ts:212-268 (handler)The main handler function for the 'describe_asset' tool. It reads a specified asset image file from the RPG Maker MZ project directory, encodes it to base64, sends it to the Gemini API along with a prompt to describe the asset, and returns the generated description or an error.export async function describeAsset( projectPath: string, assetType: string, filename: string, apiKey?: string ): Promise<{ success: boolean; description?: string; error?: string }> { const assetPath = path.join(getAssetPath(projectPath, assetType), filename); try { const imageBuffer = await fs.readFile(assetPath); const base64Image = imageBuffer.toString("base64"); const key = apiKey || process.env.GEMINI_API_KEY; if (!key) { return { success: false, error: "GEMINI_API_KEY not provided" }; } const response = await fetch( `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent?key=${key}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ contents: [{ parts: [ { text: "Describe this RPG Maker MZ asset in detail. Include style, colors, content, and suggestions for usage." }, { inlineData: { mimeType: "image/png", data: base64Image } } ] }] }) } ); if (!response.ok) { return { success: false, error: `API error: ${response.statusText}` }; } const data = await response.json(); const description = data.candidates?.[0]?.content?.parts?.[0]?.text; return { success: true, description }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }