brief.validate
Validate design briefs to assess completeness and receive improvement suggestions for better project outcomes.
Instructions
Validate design brief and return completeness score with improvement suggestions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| brief | Yes | Design brief to validate | |
| strictMode | No | Strict mode: require description, tone, colorPreferences, references (2+) (default: false) |
Implementation Reference
- The brief.validate handler function that validates input, calls the service, and returns the result.
export async function briefValidateHandler(input: unknown): Promise<BriefValidateOutput> { if (isDevelopment()) { logger.info("[MCP Tool] brief.validate called", { hasInput: input !== null && input !== undefined, }); } // 入力バリデーション let validated: BriefValidateInput; try { validated = briefValidateInputSchema.parse(input); } catch (error) { if (isDevelopment()) { logger.error("[MCP Tool] brief.validate validation error", { error }); } return { success: false, error: { code: BRIEF_MCP_ERROR_CODES.VALIDATION_ERROR, message: error instanceof Error ? error.message : "Invalid input", }, }; } try { // サービスを取得してバリデーション実行 const service = getService(); const result: BriefValidationResult = await service.validate( validated.brief, validated.strictMode ); if (isDevelopment()) { logger.info("[MCP Tool] brief.validate completed", { isValid: result.isValid, completenessScore: result.completenessScore, issueCount: result.issues.length, readyForDesign: result.readyForDesign, }); } return { success: true, data: result, }; } catch (error) { if (isDevelopment()) { logger.error("[MCP Tool] brief.validate error", { error }); } return { success: false, error: { code: BRIEF_MCP_ERROR_CODES.INTERNAL_ERROR, message: error instanceof Error ? error.message : "Validation failed", }, }; } } - Tool definition for brief.validate including the input schema.
export const briefValidateToolDefinition = { name: "brief.validate" as const, description: "Validate design brief and return completeness score with improvement suggestions.", annotations: { title: "Brief Validate", readOnlyHint: true, idempotentHint: true, openWorldHint: false, }, inputSchema: { type: "object" as const, properties: { brief: { type: "object" as const, description: "Design brief to validate", properties: { projectName: { type: "string", minLength: 1, maxLength: 200, description: "Project name (required, 1-200 chars)", }, description: { type: "string", maxLength: 2000, description: "Project description (optional, max 2000 chars)", }, targetAudience: { type: "string", maxLength: 500, description: "Target audience (optional, max 500 chars)", }, industry: { type: "string", maxLength: 100, description: "Industry/field (optional, max 100 chars)", }, tone: { type: "array", items: { type: "string", enum: [ "professional", "playful", "minimal", "bold", "elegant", "friendly", "corporate", "creative", ], }, description: "Design tone (optional): professional, playful, minimal, bold, elegant, friendly, corporate, creative", }, colorPreferences: { type: "object", description: "Color settings (optional)", properties: { primary: { type: "string", pattern: "^#[0-9A-Fa-f]{6}$", description: "Primary color (HEX: #RRGGBB)", }, secondary: { type: "string", pattern: "^#[0-9A-Fa-f]{6}$", description: "Secondary color (HEX: #RRGGBB)", }, accent: { type: "string", pattern: "^#[0-9A-Fa-f]{6}$", description: "Accent color (HEX: #RRGGBB)", }, }, }, references: { type: "array", maxItems: 10, description: "Reference sites (optional, max 10)", items: { type: "object", properties: { url: { type: "string", format: "uri", description: "Reference site URL", }, note: { type: "string", maxLength: 200, description: "Note (max 200 chars)", }, }, required: ["url"], }, }, constraints: { type: "object", description: "Constraints (optional)", properties: { mustHave: { type: "array", items: { type: "string" }, description: "Required elements", }, mustAvoid: { type: "array", items: { type: "string" }, description: "Elements to avoid", }, }, }, }, required: ["projectName"], }, strictMode: { type: "boolean", default: false, description: "Strict mode: require description, tone, colorPreferences, references (2+) (default: false)", }, }, required: ["brief"], }, };