generate_icon
Create app icons, favicons, and UI elements in multiple sizes and formats using natural language prompts. Specify visual style, background, corners, and output format for custom icon generation.
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-548 (handler)Handler for generate_icon tool: constructs a specialized prompt using buildIconPrompt and calls the shared image generator.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/types.ts:47-53 (schema)TypeScript interface defining the arguments for the generate_icon tool.export interface IconPromptArgs { prompt?: string; type?: string; style?: string; background?: string; corners?: string; }
- mcp-server/src/server.ts:222-279 (registration)Registration of the generate_icon tool in the list of available tools, including detailed input schema.{ 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-645 (helper)Helper function that constructs the AI prompt for generating icons based on provided 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; }