feat: implement comprehensive workflow validation (v2.5.0)
Major Features: - Add ExpressionValidator for n8n expression syntax validation - Add WorkflowValidator for complete workflow structure validation - Add three new MCP tools: validate_workflow, validate_workflow_connections, validate_workflow_expressions Validation Capabilities: - ✅ Detects workflow cycles (infinite loops) - ✅ Validates n8n expressions with syntax checking - ✅ Checks node references in expressions - ✅ Identifies orphaned nodes and missing connections - ✅ Supports multiple node type formats (n8n-nodes-base, @n8n/n8n-nodes-langchain) - ✅ Provides actionable error messages and suggestions Testing & Analysis: - Add test scripts for workflow validation - Add template validation testing - Add validation summary analysis tool - Fixed expression validation false positives - Handle node type normalization correctly Results from testing 50 real n8n templates: - 70.9% of errors are from informal sticky notes - Expression validation catches real syntax issues - Cycle detection prevents runtime infinite loops - Successfully validates both core and LangChain nodes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -318,6 +318,75 @@ export const n8nDocumentationToolsFinal: ToolDefinition[] = [
|
||||
required: ['task'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'validate_workflow',
|
||||
description: `Validate an entire n8n workflow before deployment. Checks: workflow structure, node connections, expressions, best practices, and more. Returns comprehensive validation report with errors, warnings, and suggestions. Essential for AI agents building complete workflows. Prevents common workflow errors before they happen.`,
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
workflow: {
|
||||
type: 'object',
|
||||
description: 'The complete workflow JSON to validate. Must include nodes array and connections object.',
|
||||
},
|
||||
options: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
validateNodes: {
|
||||
type: 'boolean',
|
||||
description: 'Validate individual node configurations. Default true.',
|
||||
default: true,
|
||||
},
|
||||
validateConnections: {
|
||||
type: 'boolean',
|
||||
description: 'Validate node connections and flow. Default true.',
|
||||
default: true,
|
||||
},
|
||||
validateExpressions: {
|
||||
type: 'boolean',
|
||||
description: 'Validate n8n expressions syntax and references. Default true.',
|
||||
default: true,
|
||||
},
|
||||
profile: {
|
||||
type: 'string',
|
||||
enum: ['minimal', 'runtime', 'ai-friendly', 'strict'],
|
||||
description: 'Validation profile for node validation. Default "runtime".',
|
||||
default: 'runtime',
|
||||
},
|
||||
},
|
||||
description: 'Optional validation settings',
|
||||
},
|
||||
},
|
||||
required: ['workflow'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'validate_workflow_connections',
|
||||
description: `Validate only the connections in a workflow. Checks: all connections point to existing nodes, no cycles (infinite loops), no orphaned nodes, proper trigger node setup. Faster than full validation when you only need to check workflow structure.`,
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
workflow: {
|
||||
type: 'object',
|
||||
description: 'The workflow JSON with nodes array and connections object.',
|
||||
},
|
||||
},
|
||||
required: ['workflow'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'validate_workflow_expressions',
|
||||
description: `Validate all n8n expressions in a workflow. Checks: expression syntax ({{ }}), variable references ($json, $node, $input), node references exist, context availability. Returns specific errors with locations. Use this to catch expression errors before runtime.`,
|
||||
inputSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
workflow: {
|
||||
type: 'object',
|
||||
description: 'The workflow JSON to check for expression errors.',
|
||||
},
|
||||
},
|
||||
required: ['workflow'],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user