generate_pattern
Generate seamless patterns and textures for backgrounds and design elements using customizable parameters like style, density, and color schemes.
Instructions
Generate seamless patterns and textures for backgrounds and design elements
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Description of the pattern or texture to generate | |
| size | No | Pattern tile size (e.g., "256x256", "512x512") | 256x256 |
| type | No | Type of pattern to generate | seamless |
| style | No | Pattern style | abstract |
| density | No | Element density in the pattern | medium |
| colors | No | Color scheme | colorful |
| repeat | No | Tiling method for seamless patterns | tile |
| preview | No | Automatically open generated images in default viewer |
Implementation Reference
- mcp-server/src/server.ts:550-564 (handler)Main handler for the generate_pattern tool: builds specialized prompt and delegates image generation to ImageGeneratorcase "generate_pattern": { const prompt = this.buildPatternPrompt(args); const imageRequest: ImageGenerationRequest = { prompt, outputCount: 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:280-336 (registration)Registration of the generate_pattern tool in the ListTools response, defining name, description, and input schema{ name: "generate_pattern", description: "Generate seamless patterns and textures for backgrounds and design elements", inputSchema: { type: "object", properties: { prompt: { type: "string", description: "Description of the pattern or texture to generate", }, size: { type: "string", description: 'Pattern tile size (e.g., "256x256", "512x512")', default: "256x256", }, type: { type: "string", enum: ["seamless", "texture", "wallpaper"], description: "Type of pattern to generate", default: "seamless", }, style: { type: "string", enum: ["geometric", "organic", "abstract", "floral", "tech"], description: "Pattern style", default: "abstract", }, density: { type: "string", enum: ["sparse", "medium", "dense"], description: "Element density in the pattern", default: "medium", }, colors: { type: "string", enum: ["mono", "duotone", "colorful"], description: "Color scheme", default: "colorful", }, repeat: { type: "string", enum: ["tile", "mirror"], description: "Tiling method for seamless patterns", default: "tile", }, preview: { type: "boolean", description: "Automatically open generated images in default viewer", default: false, }, }, required: ["prompt"], }, },
- mcp-server/src/server.ts:647-664 (helper)Helper function that builds the specialized prompt for pattern generation based on input argumentsprivate buildPatternPrompt(args?: PatternPromptArgs): string { const basePrompt = args?.prompt || "abstract pattern"; const type = args?.type || "seamless"; const style = args?.style || "abstract"; const density = args?.density || "medium"; const colors = args?.colors || "colorful"; const size = args?.size || "256x256"; let prompt = `${basePrompt}, ${style} style ${type} pattern, ${density} density, ${colors} colors`; if (type === "seamless") { prompt += ", tileable, repeating pattern"; } prompt += `, ${size} tile size, high quality`; return prompt; }
- mcp-server/src/types.ts:55-62 (schema)TypeScript interface defining the arguments for the generate_pattern tool (PatternPromptArgs)export interface PatternPromptArgs { prompt?: string; type?: string; style?: string; density?: string; colors?: string; size?: string; }