generate_icon
Create app icons, favicons, and UI elements in multiple sizes and formats from text descriptions using the Nano Banana MCP server.
Instructions
Generate app icons, favicons, and UI elements in multiple sizes and formats
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Description of the icon or UI element to generate | |
| sizes | No | Array of icon sizes in pixels (16, 32, 64, 128, 256, 512, 1024) | |
| type | No | Type of icon to generate | app-icon |
| style | No | Visual style of the icon | modern |
| format | No | Output format | png |
| background | No | Background type: transparent, white, black, or color name | transparent |
| corners | No | Corner style for app icons | rounded |
| preview | No | Automatically open generated images in default viewer |
Implementation Reference
- mcp-server/src/server.ts:531-547 (handler)Main execution logic for the generate_icon tool: builds a custom prompt using helper and calls the shared image generator with icon-specific parameters.case "generate_icon": { const prompt = this.buildIconPrompt(args); const imageRequest: ImageGenerationRequest = { prompt, outputCount: Array.isArray(args?.sizes) && args?.sizes.length > 0 ? args.sizes.length : 1, mode: "generate", preview: args?.preview as boolean, noPreview: (args?.noPreview as boolean) || (args?.["no-preview"] as boolean), }; response = await this.imageGenerator.generateTextToImage(imageRequest); break;
- mcp-server/src/server.ts:222-278 (schema)Tool registration including name, description, and detailed input schema for generate_icon.{ name: "generate_icon", description: "Generate app icons, favicons, and UI elements in multiple sizes and formats", inputSchema: { type: "object", properties: { prompt: { type: "string", description: "Description of the icon or UI element to generate", }, sizes: { type: "array", items: { type: "number" }, description: "Array of icon sizes in pixels (16, 32, 64, 128, 256, 512, 1024)", }, type: { type: "string", enum: ["app-icon", "favicon", "ui-element"], description: "Type of icon to generate", default: "app-icon", }, style: { type: "string", enum: ["flat", "skeuomorphic", "minimal", "modern"], description: "Visual style of the icon", default: "modern", }, format: { type: "string", enum: ["png", "jpeg"], description: "Output format", default: "png", }, background: { type: "string", description: "Background type: transparent, white, black, or color name", default: "transparent", }, corners: { type: "string", enum: ["rounded", "sharp"], description: "Corner style for app icons", default: "rounded", }, preview: { type: "boolean", description: "Automatically open generated images in default viewer", default: false, }, }, required: ["prompt"], },
- mcp-server/src/server.ts:625-644 (helper)Helper method to construct the AI prompt tailored for icon generation based on input arguments.private buildIconPrompt(args?: IconPromptArgs): string { const basePrompt = args?.prompt || "app icon"; const type = args?.type || "app-icon"; const style = args?.style || "modern"; const background = args?.background || "transparent"; const corners = args?.corners || "rounded"; let prompt = `${basePrompt}, ${style} style ${type}`; if (type === "app-icon") { prompt += `, ${corners} corners`; } if (background !== "transparent") { prompt += `, ${background} background`; } prompt += ", clean design, high quality, professional"; return prompt;
- mcp-server/src/types.ts:47-52 (schema)TypeScript interface defining the shape of arguments for icon prompt building.export interface IconPromptArgs { prompt?: string; type?: string; style?: string; background?: string; corners?: string;