generate_pattern
Create 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)Executes the generate_pattern tool by building a specialized prompt and invoking the shared image generation service.case "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 (schema)Defines the tool schema including input parameters for the generate_pattern tool, used for both registration and validation.{ 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)Constructs the detailed text prompt for pattern generation by combining user arguments with defaults and pattern-specific descriptors.private 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 matching the input schema for pattern prompt arguments.export interface PatternPromptArgs { prompt?: string; type?: string; style?: string; density?: string; colors?: string; size?: string; }