build_prompt
Create optimized image generation prompts by specifying subject, style, lighting, camera angle, mood, color palette, and quality enhancements.
Instructions
Build an optimized prompt from subject + style/lighting/camera/mood/color/quality options
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subject | Yes | Main subject of the image | |
| style | No | Visual style | |
| lighting | No | Lighting type | |
| camera | No | Camera angle | |
| mood | No | Mood/atmosphere | |
| color | No | Color palette | |
| quality_tags | No | Quality enhancement tags |
Implementation Reference
- src/tools.ts:153-158 (handler)The handleBuildPrompt function acts as the MCP tool handler, which calls the utility function `buildPrompt` and formats the result for the MCP client.
export function handleBuildPrompt(args: z.infer<typeof buildPromptSchema>) { const prompt = buildPrompt(args); return { content: [{ type: "text" as const, text: `Generated prompt:\n${prompt}` }], }; } - src/styles.ts:63-98 (helper)The buildPrompt helper function constructs the final text prompt by assembling user input with predefined mappings.
export function buildPrompt(options: { subject: string; style?: string; lighting?: string; camera?: string; mood?: string; color?: string; quality_tags?: string[]; }): string { const parts: string[] = [options.subject]; if (options.style && styleMappings[options.style]) { parts.push(styleMappings[options.style]); } if (options.lighting && lightingMappings[options.lighting]) { parts.push(lightingMappings[options.lighting]); } if (options.camera && cameraMappings[options.camera]) { parts.push(cameraMappings[options.camera]); } if (options.mood && moodMappings[options.mood]) { parts.push(moodMappings[options.mood]); } if (options.color && colorMappings[options.color]) { parts.push(colorMappings[options.color]); } if (options.quality_tags) { for (const tag of options.quality_tags) { if (qualityTagMappings[tag]) { parts.push(qualityTagMappings[tag]); } } } return parts.join(", "); } - src/tools.ts:29-55 (schema)The zod schema for the 'build_prompt' tool, defining input validation and documentation for the parameters.
export const buildPromptSchema = z.object({ subject: z.string().describe("Main subject of the image"), style: z .enum(Object.keys(styleMappings) as [string, ...string[]]) .optional() .describe("Visual style"), lighting: z .enum(Object.keys(lightingMappings) as [string, ...string[]]) .optional() .describe("Lighting type"), camera: z .enum(Object.keys(cameraMappings) as [string, ...string[]]) .optional() .describe("Camera angle"), mood: z .enum(Object.keys(moodMappings) as [string, ...string[]]) .optional() .describe("Mood/atmosphere"), color: z .enum(Object.keys(colorMappings) as [string, ...string[]]) .optional() .describe("Color palette"), quality_tags: z .array(z.enum(Object.keys(qualityTagMappings) as [string, ...string[]])) .optional() .describe("Quality enhancement tags"), });