Skip to main content
Glama

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
NameRequiredDescriptionDefault
subjectYesMain subject of the image
styleNoVisual style
lightingNoLighting type
cameraNoCamera angle
moodNoMood/atmosphere
colorNoColor palette
quality_tagsNoQuality enhancement tags

Implementation Reference

  • 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}` }],
      };
    }
  • 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(", ");
    }
  • 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"),
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool builds a prompt but doesn't explain what 'optimized' means, whether it's a read-only or mutation operation, if there are rate limits, authentication needs, or what the output format looks like. This leaves significant gaps for an AI agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly lists the input components, making it easy to parse and understand quickly. Every part of the sentence serves a clear informational purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (7 parameters, 1 required) and lack of annotations or output schema, the description is adequate but incomplete. It covers what the tool does but misses behavioral context, output details, and usage guidelines. Without an output schema, the agent doesn't know what the built prompt looks like, which is a notable gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions and enums for most parameters. The description adds minimal value beyond the schema by listing the parameter categories (subject, style, lighting, camera, mood, color, quality options), but doesn't provide additional syntax, format details, or usage examples. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Build an optimized prompt from subject + style/lighting/camera/mood/color/quality options'. It specifies the verb ('Build'), resource ('optimized prompt'), and input components. However, it doesn't explicitly differentiate from sibling tools like 'generate_image' or 'list_styles', which might be related but serve different functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, when not to use it, or how it relates to sibling tools such as 'generate_image' (which might use the built prompt) or 'list_styles'. Usage is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/doctorm333/promptpilot-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server