diff --git a/src/mcp/server.ts b/src/mcp/server.ts index 1443715..05ab867 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -2659,24 +2659,19 @@ Full documentation is being prepared. For now, use get_node_essentials for confi expressionsValidated: result.statistics.expressionsValidated, errorCount: result.errors.length, warningCount: result.warnings.length - } - }; - - if (result.errors.length > 0) { - response.errors = result.errors.map(e => ({ + }, + // Always include errors and warnings arrays for consistent API response + errors: result.errors.map(e => ({ node: e.nodeName || 'workflow', message: e.message, details: e.details - })); - } - - if (result.warnings.length > 0) { - response.warnings = result.warnings.map(w => ({ + })), + warnings: result.warnings.map(w => ({ node: w.nodeName || 'workflow', message: w.message, details: w.details - })); - } + })) + }; if (result.suggestions.length > 0) { response.suggestions = result.suggestions; diff --git a/src/services/config-validator.ts b/src/services/config-validator.ts index c8aa5d9..cea5ebb 100644 --- a/src/services/config-validator.ts +++ b/src/services/config-validator.ts @@ -108,16 +108,16 @@ export class ConfigValidator { * Check for missing required properties */ private static checkRequiredProperties( - properties: any[], - config: Record, + properties: any[], + config: Record, errors: ValidationError[] ): void { for (const prop of properties) { if (!prop || !prop.name) continue; // Skip invalid properties - + if (prop.required) { const value = config[prop.name]; - + // Check if property is missing or has null/undefined value if (!(prop.name in config)) { errors.push({ @@ -133,6 +133,14 @@ export class ConfigValidator { message: `Required property '${prop.displayName || prop.name}' cannot be null or undefined`, fix: `Provide a valid value for ${prop.name}` }); + } else if (typeof value === 'string' && value.trim() === '') { + // Check for empty strings which are invalid for required string properties + errors.push({ + type: 'missing_required', + property: prop.name, + message: `Required property '${prop.displayName || prop.name}' cannot be empty`, + fix: `Provide a valid value for ${prop.name}` + }); } } }