validate_node_config
Validate node configuration parameters against type definitions to ensure proper setup and prevent errors in n8n workflows.
Instructions
Validate a node configuration against its type definition
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| credentials | No | Optional credentials object | |
| params | Yes | The node parameters to validate | |
| type | Yes | The node type name |
Implementation Reference
- src/index.ts:138-159 (registration)Tool registration in the MCP server's listTools response, including input schema definition.{ name: 'validate_node_config', description: 'Validate a node configuration against its type definition', inputSchema: { type: 'object', properties: { type: { type: 'string', description: 'The node type name', }, params: { type: 'object', description: 'The node parameters to validate', }, credentials: { type: 'object', description: 'Optional credentials object', }, }, required: ['type', 'params'], }, },
- src/index.ts:703-715 (handler)Primary MCP server handler for 'validate_node_config' tool that delegates to N8nClient.private async handleValidateNodeConfig(args: { type: string; params: Record<string, any>; credentials?: Record<string, string> }) { const result = await this.n8nClient.validateNodeConfiguration( args.type, args.params, args.credentials ); return { content: [{ type: 'text', text: JSON.stringify(jsonSuccess(result), null, 2) }] }; }
- src/n8n-client.ts:303-309 (handler)N8nClient method that performs node configuration validation by calling node-validator.async validateNodeConfiguration( nodeType: string, parameters: Record<string, any>, credentials?: Record<string, string> ): Promise<ValidationResult> { return validateFullNodeConfig(nodeType, parameters, credentials); }
- src/node-validator.ts:267-279 (handler)Core validation function combining parameter and credential validation.export function validateFullNodeConfig( nodeType: string, parameters: Record<string, any>, credentials: Record<string, string> = {} ): ValidationResult { const parameterValidation = validateNodeConfig(nodeType, parameters); const credentialErrors = validateCredentials(nodeType, credentials); return { valid: parameterValidation.valid && credentialErrors.length === 0, errors: [...parameterValidation.errors, ...credentialErrors], }; }
- src/node-validator.ts:7-34 (helper)Helper function that validates node parameters against the node type schema properties.export function validateNodeConfig(nodeType: string, parameters: Record<string, any>): ValidationResult { const errors: ValidationError[] = []; // Get the node type definition const nodeTypeDef = getNodeType(nodeType); if (!nodeTypeDef) { errors.push({ property: 'type', message: `Unknown node type: ${nodeType}`, code: 'INVALID_TYPE', expected: 'Known node type', actual: nodeType, }); return { valid: false, errors }; } // Validate each property in the node type definition for (const property of nodeTypeDef.properties) { const value = parameters[property.name]; const propertyErrors = validateProperty(property, value, parameters); errors.push(...propertyErrors); } return { valid: errors.length === 0, errors, }; }