mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 22:42:04 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
808088f25e | ||
|
|
20663dad0d | ||
|
|
705d31c35e |
68
CHANGELOG.md
68
CHANGELOG.md
@@ -7,6 +7,74 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.31.3] - 2025-12-26
|
||||
|
||||
### Fixed
|
||||
|
||||
**Documentation Bug: Connection Keys Say "Node IDs" but Require "Node Names" (Issue #510)**
|
||||
|
||||
Fixed documentation that incorrectly stated connection keys should be "node IDs" when n8n actually requires "node names".
|
||||
|
||||
**Problem:**
|
||||
The `n8n_create_workflow` documentation and examples showed using node IDs (e.g., `"webhook_1"`) as connection keys, but the validator requires node names (e.g., `"Webhook"`). This caused workflow creation failures and contributed to low success rates for AI-generated workflows.
|
||||
|
||||
**Changes:**
|
||||
- Updated `tools-n8n-manager.ts` parameter description: "Keys are source node names (the name field, not id)"
|
||||
- Updated `n8n-create-workflow.ts` documentation: "Keys are source node names (not IDs)"
|
||||
- Fixed example to use `"Webhook"` and `"Slack"` instead of `"webhook_1"` and `"slack_1"`
|
||||
- Clarified `get-template.ts` return description
|
||||
|
||||
**Before (incorrect):**
|
||||
```javascript
|
||||
connections: {
|
||||
"webhook_1": { "main": [[{node: "slack_1", ...}]] } // WRONG
|
||||
}
|
||||
```
|
||||
|
||||
**After (correct):**
|
||||
```javascript
|
||||
connections: {
|
||||
"Webhook": { "main": [[{node: "Slack", ...}]] } // CORRECT
|
||||
}
|
||||
```
|
||||
|
||||
**Impact:**
|
||||
- AI models following documentation will now generate valid workflows
|
||||
- Clear distinction between node `id` (internal identifier) and `name` (connection key)
|
||||
- No breaking changes - validator behavior unchanged
|
||||
|
||||
## [2.31.2] - 2025-12-24
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated n8n from 2.0.2 to 2.1.4
|
||||
- Updated n8n-core from 2.0.1 to 2.1.3
|
||||
- Updated n8n-workflow from 2.0.1 to 2.1.1
|
||||
- Updated @n8n/n8n-nodes-langchain from 2.0.1 to 2.1.3
|
||||
- Rebuilt node database with 540 nodes (434 from n8n-nodes-base, 106 from @n8n/n8n-nodes-langchain)
|
||||
- Refreshed template database with 2,737 workflow templates from n8n.io
|
||||
|
||||
## [2.31.1] - 2025-12-23
|
||||
|
||||
### Fixed
|
||||
|
||||
**mcpTrigger Nodes No Longer Incorrectly Flagged as "Disconnected" (Issue #503)**
|
||||
|
||||
Fixed a validation bug where `mcpTrigger` nodes were incorrectly flagged as "disconnected nodes" when using `n8n_update_partial_workflow` or `n8n_update_full_workflow`. This blocked ALL updates to MCP server workflows.
|
||||
|
||||
**Root Cause:**
|
||||
The `validateWorkflowStructure()` function only checked `main` connections when building the connected nodes set, ignoring AI connection types (`ai_tool`, `ai_languageModel`, `ai_memory`, `ai_embedding`, `ai_vectorStore`). Additionally, trigger nodes were only checked for outgoing connections, but `mcpTrigger` only receives inbound `ai_tool` connections.
|
||||
|
||||
**Changes:**
|
||||
- Extended connection validation to check all 7 connection types (main, error, ai_tool, ai_languageModel, ai_memory, ai_embedding, ai_vectorStore)
|
||||
- Updated trigger node validation to accept either outgoing OR inbound connections
|
||||
- Added 7 new tests covering all AI connection types
|
||||
|
||||
**Impact:**
|
||||
- MCP server workflows can now be updated, renamed, and deactivated normally
|
||||
- All `n8n_update_*` operations work correctly for AI workflows
|
||||
- No breaking changes for existing workflows
|
||||
|
||||
## [2.31.0] - 2025-12-23
|
||||
|
||||
### Added
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[](https://www.npmjs.com/package/n8n-mcp)
|
||||
[](https://codecov.io/gh/czlonkowski/n8n-mcp)
|
||||
[](https://github.com/czlonkowski/n8n-mcp/actions)
|
||||
[](https://github.com/n8n-io/n8n)
|
||||
[](https://github.com/n8n-io/n8n)
|
||||
[](https://github.com/czlonkowski/n8n-mcp/pkgs/container/n8n-mcp)
|
||||
[](https://railway.com/deploy/n8n-mcp?referralCode=n8n-mcp)
|
||||
|
||||
|
||||
BIN
data/nodes.db
BIN
data/nodes.db
Binary file not shown.
2
dist/mcp/handlers-n8n-manager.d.ts.map
vendored
2
dist/mcp/handlers-n8n-manager.d.ts.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"handlers-n8n-manager.d.ts","sourceRoot":"","sources":["../../src/mcp/handlers-n8n-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAML,eAAe,EAGhB,MAAM,kBAAkB,CAAC;AAkB1B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAA2B,MAAM,2BAA2B,CAAC;AAOrF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAqNhE,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD;AAMD,wBAAgB,uBAAuB,gDAEtC;AAKD,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAED,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAgF9E;AAqHD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAmF7G;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAiC1G;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAoDjH;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAmDnH;AAED,wBAAsB,wBAA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C,eAAe,CAAC,CAwJ3G;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CA8H3G;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAgD7G;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAiC9G;AAID,wBAAsB,iBAAiB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAwG3F;AAkLD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAkQxG;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,cAAc,EAC1B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,eAAe,CAAC,CAsL1B;AA+BD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,OAAO,EACb,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,cAAc,EAC1B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,eAAe,CAAC,CAoM1B;AAQD,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAyErH"}
|
||||
29
dist/mcp/handlers-n8n-manager.js
vendored
29
dist/mcp/handlers-n8n-manager.js
vendored
@@ -1024,14 +1024,18 @@ async function handleGetExecution(args, context) {
|
||||
const client = ensureApiConfigured(context);
|
||||
const schema = zod_1.z.object({
|
||||
id: zod_1.z.string(),
|
||||
mode: zod_1.z.enum(['preview', 'summary', 'filtered', 'full']).optional(),
|
||||
mode: zod_1.z.enum(['preview', 'summary', 'filtered', 'full', 'error']).optional(),
|
||||
nodeNames: zod_1.z.array(zod_1.z.string()).optional(),
|
||||
itemsLimit: zod_1.z.number().optional(),
|
||||
includeInputData: zod_1.z.boolean().optional(),
|
||||
includeData: zod_1.z.boolean().optional()
|
||||
includeData: zod_1.z.boolean().optional(),
|
||||
errorItemsLimit: zod_1.z.number().min(0).max(100).optional(),
|
||||
includeStackTrace: zod_1.z.boolean().optional(),
|
||||
includeExecutionPath: zod_1.z.boolean().optional(),
|
||||
fetchWorkflow: zod_1.z.boolean().optional()
|
||||
});
|
||||
const params = schema.parse(args);
|
||||
const { id, mode, nodeNames, itemsLimit, includeInputData, includeData } = params;
|
||||
const { id, mode, nodeNames, itemsLimit, includeInputData, includeData, errorItemsLimit, includeStackTrace, includeExecutionPath, fetchWorkflow } = params;
|
||||
let effectiveMode = mode;
|
||||
if (!effectiveMode && includeData !== undefined) {
|
||||
effectiveMode = includeData ? 'summary' : undefined;
|
||||
@@ -1044,13 +1048,28 @@ async function handleGetExecution(args, context) {
|
||||
data: execution
|
||||
};
|
||||
}
|
||||
let workflow;
|
||||
if (effectiveMode === 'error' && fetchWorkflow !== false && execution.workflowId) {
|
||||
try {
|
||||
workflow = await client.getWorkflow(execution.workflowId);
|
||||
}
|
||||
catch (e) {
|
||||
logger_1.logger.debug('Could not fetch workflow for error analysis', {
|
||||
workflowId: execution.workflowId,
|
||||
error: e instanceof Error ? e.message : 'Unknown error'
|
||||
});
|
||||
}
|
||||
}
|
||||
const filterOptions = {
|
||||
mode: effectiveMode,
|
||||
nodeNames,
|
||||
itemsLimit,
|
||||
includeInputData
|
||||
includeInputData,
|
||||
errorItemsLimit,
|
||||
includeStackTrace,
|
||||
includeExecutionPath
|
||||
};
|
||||
const processedExecution = (0, execution_processor_1.processExecution)(execution, filterOptions);
|
||||
const processedExecution = (0, execution_processor_1.processExecution)(execution, filterOptions, workflow);
|
||||
return {
|
||||
success: true,
|
||||
data: processedExecution
|
||||
|
||||
2
dist/mcp/handlers-n8n-manager.js.map
vendored
2
dist/mcp/handlers-n8n-manager.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"version":3,"file":"n8n-executions.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-executions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,gBAAgB,EAAE,iBA+E9B,CAAC"}
|
||||
{"version":3,"file":"n8n-executions.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-executions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,gBAAgB,EAAE,iBAwG9B,CAAC"}
|
||||
@@ -6,13 +6,14 @@ exports.n8nExecutionsDoc = {
|
||||
category: 'workflow_management',
|
||||
essentials: {
|
||||
description: 'Manage workflow executions: get details, list, or delete. Unified tool for all execution operations.',
|
||||
keyParameters: ['action', 'id', 'workflowId', 'status'],
|
||||
example: 'n8n_executions({action: "list", workflowId: "abc123", status: "error"})',
|
||||
keyParameters: ['action', 'id', 'workflowId', 'status', 'mode'],
|
||||
example: 'n8n_executions({action: "get", id: "exec_456", mode: "error"})',
|
||||
performance: 'Fast (50-200ms)',
|
||||
tips: [
|
||||
'action="get": Get execution details by ID',
|
||||
'action="list": List executions with filters',
|
||||
'action="delete": Delete execution record',
|
||||
'Use mode="error" for efficient failure debugging (80-90% token savings)',
|
||||
'Use mode parameter for action=get to control detail level'
|
||||
]
|
||||
},
|
||||
@@ -26,14 +27,26 @@ exports.n8nExecutionsDoc = {
|
||||
- preview: Structure only, no data
|
||||
- summary: 2 items per node (default)
|
||||
- filtered: Custom items limit, optionally filter by node names
|
||||
- full: All execution data (can be very large)`,
|
||||
- full: All execution data (can be very large)
|
||||
- error: Optimized for debugging failures - extracts error info, upstream context, and AI suggestions
|
||||
|
||||
**Error Mode Features:**
|
||||
- Extracts error message, type, and node configuration
|
||||
- Samples input data from upstream node (configurable limit)
|
||||
- Shows execution path leading to error
|
||||
- Provides AI-friendly fix suggestions based on error patterns
|
||||
- Token-efficient (80-90% smaller than full mode)`,
|
||||
parameters: {
|
||||
action: { type: 'string', required: true, description: 'Operation: "get", "list", or "delete"' },
|
||||
id: { type: 'string', required: false, description: 'Execution ID (required for action=get or action=delete)' },
|
||||
mode: { type: 'string', required: false, description: 'For action=get: "preview", "summary" (default), "filtered", "full"' },
|
||||
mode: { type: 'string', required: false, description: 'For action=get: "preview", "summary" (default), "filtered", "full", "error"' },
|
||||
nodeNames: { type: 'array', required: false, description: 'For action=get with mode=filtered: Filter to specific nodes by name' },
|
||||
itemsLimit: { type: 'number', required: false, description: 'For action=get with mode=filtered: Items per node (0=structure, 2=default, -1=unlimited)' },
|
||||
includeInputData: { type: 'boolean', required: false, description: 'For action=get: Include input data in addition to output (default: false)' },
|
||||
errorItemsLimit: { type: 'number', required: false, description: 'For action=get with mode=error: Sample items from upstream (default: 2, max: 100)' },
|
||||
includeStackTrace: { type: 'boolean', required: false, description: 'For action=get with mode=error: Include full stack trace (default: false, shows truncated)' },
|
||||
includeExecutionPath: { type: 'boolean', required: false, description: 'For action=get with mode=error: Include execution path (default: true)' },
|
||||
fetchWorkflow: { type: 'boolean', required: false, description: 'For action=get with mode=error: Fetch workflow for accurate upstream detection (default: true)' },
|
||||
workflowId: { type: 'string', required: false, description: 'For action=list: Filter by workflow ID' },
|
||||
status: { type: 'string', required: false, description: 'For action=list: Filter by status ("success", "error", "waiting")' },
|
||||
limit: { type: 'number', required: false, description: 'For action=list: Number of results (1-100, default: 100)' },
|
||||
@@ -42,10 +55,15 @@ exports.n8nExecutionsDoc = {
|
||||
includeData: { type: 'boolean', required: false, description: 'For action=list: Include execution data (default: false)' }
|
||||
},
|
||||
returns: `Depends on action:
|
||||
- get: Execution object with data based on mode
|
||||
- get (error mode): { errorInfo: { primaryError, upstreamContext, executionPath, suggestions }, summary }
|
||||
- get (other modes): Execution object with data based on mode
|
||||
- list: { data: [...executions], nextCursor?: string }
|
||||
- delete: { success: boolean, message: string }`,
|
||||
examples: [
|
||||
'// Debug a failed execution (recommended for errors)\nn8n_executions({action: "get", id: "exec_456", mode: "error"})',
|
||||
'// Debug with more sample data from upstream\nn8n_executions({action: "get", id: "exec_456", mode: "error", errorItemsLimit: 5})',
|
||||
'// Debug with full stack trace\nn8n_executions({action: "get", id: "exec_456", mode: "error", includeStackTrace: true})',
|
||||
'// Debug without workflow fetch (faster but less accurate)\nn8n_executions({action: "get", id: "exec_456", mode: "error", fetchWorkflow: false})',
|
||||
'// List recent executions for a workflow\nn8n_executions({action: "list", workflowId: "abc123", limit: 10})',
|
||||
'// List failed executions\nn8n_executions({action: "list", status: "error"})',
|
||||
'// Get execution summary\nn8n_executions({action: "get", id: "exec_456"})',
|
||||
@@ -54,7 +72,10 @@ exports.n8nExecutionsDoc = {
|
||||
'// Delete an execution\nn8n_executions({action: "delete", id: "exec_456"})'
|
||||
],
|
||||
useCases: [
|
||||
'Debug workflow failures (get with mode=full)',
|
||||
'Debug workflow failures efficiently (mode=error) - 80-90% token savings',
|
||||
'Get AI suggestions for fixing common errors',
|
||||
'Analyze input data that caused failure',
|
||||
'Debug workflow failures with full data (mode=full)',
|
||||
'Monitor workflow health (list with status filter)',
|
||||
'Audit execution history',
|
||||
'Clean up old execution records',
|
||||
@@ -63,18 +84,22 @@ exports.n8nExecutionsDoc = {
|
||||
performance: `Response times:
|
||||
- list: 50-150ms depending on filters
|
||||
- get (preview/summary): 30-100ms
|
||||
- get (error): 50-200ms (includes optional workflow fetch)
|
||||
- get (full): 100-500ms+ depending on data size
|
||||
- delete: 30-80ms`,
|
||||
bestPractices: [
|
||||
'Use mode="summary" (default) for debugging - shows enough data',
|
||||
'Use mode="error" for debugging failed executions - 80-90% token savings vs full',
|
||||
'Use mode="summary" (default) for quick inspection',
|
||||
'Use mode="filtered" with nodeNames for large workflows',
|
||||
'Filter by workflowId when listing to reduce results',
|
||||
'Use cursor for pagination through large result sets',
|
||||
'Set fetchWorkflow=false if you already know the workflow structure',
|
||||
'Delete old executions to save storage'
|
||||
],
|
||||
pitfalls: [
|
||||
'Requires N8N_API_URL and N8N_API_KEY configured',
|
||||
'mode="full" can return very large responses for complex workflows',
|
||||
'mode="error" fetches workflow by default (adds ~50-100ms), disable with fetchWorkflow=false',
|
||||
'Execution must exist or returns 404',
|
||||
'Delete is permanent - cannot undo'
|
||||
],
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"n8n-executions.js","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-executions.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAsB;IACjD,IAAI,EAAE,gBAAgB;IACtB,QAAQ,EAAE,qBAAqB;IAC/B,UAAU,EAAE;QACV,WAAW,EAAE,sGAAsG;QACnH,aAAa,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC;QACvD,OAAO,EAAE,yEAAyE;QAClF,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE;YACJ,2CAA2C;YAC3C,6CAA6C;YAC7C,0CAA0C;YAC1C,2DAA2D;SAC5D;KACF;IACD,IAAI,EAAE;QACJ,WAAW,EAAE;;;;;;;;;+CAS8B;QAC3C,UAAU,EAAE;YACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uCAAuC,EAAE;YAChG,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,yDAAyD,EAAE;YAC/G,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,oEAAoE,EAAE;YAC5H,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EA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A6G;YAC7G,8EAA8E;YAC9E,2EAA2E;YAC3E,2FAA2F;YAC3F,+IAA+I;YAC/I,4EAA4E;SAC7E;QACD,QAAQ,EAAE;YACR,yEAAyE;YACzE,6CAA6C;YAC7C,wCAAwC;YACxC,oDAAoD;YACpD,mDAAmD;YACnD,yBAAyB;YACzB,gCAAgC;YAChC,+BAA+B;SAChC;QACD,WAAW,EAAE;;;;;kBAKC;QACd,aAAa,EAAE;YACb,iFAAiF;YACjF,mDAAmD;YACnD,wDAAwD;YACxD,qDAAqD;YACrD,qDAAqD;YACrD,oEAAoE;YACpE,uCAAuC;SACxC;QACD,QAAQ,EAAE;YACR,iDAAiD;YACjD,mEAAmE;YACnE,6FAA6F;YAC7F,qCAAqC;YACrC,mCAAmC;SACpC;QACD,YAAY,EAAE,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,uBAAuB,CAAC;KACjF;CACF,CAAC"}
|
||||
2
dist/mcp/tools-n8n-manager.d.ts.map
vendored
2
dist/mcp/tools-n8n-manager.d.ts.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"tools-n8n-manager.d.ts","sourceRoot":"","sources":["../../src/mcp/tools-n8n-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAQ1C,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAmf9C,CAAC"}
|
||||
{"version":3,"file":"tools-n8n-manager.d.ts","sourceRoot":"","sources":["../../src/mcp/tools-n8n-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAQ1C,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAogB9C,CAAC"}
|
||||
20
dist/mcp/tools-n8n-manager.js
vendored
20
dist/mcp/tools-n8n-manager.js
vendored
@@ -336,8 +336,8 @@ exports.n8nManagementTools = [
|
||||
},
|
||||
mode: {
|
||||
type: 'string',
|
||||
enum: ['preview', 'summary', 'filtered', 'full'],
|
||||
description: 'For action=get: preview=structure only, summary=2 items (default), filtered=custom, full=all data'
|
||||
enum: ['preview', 'summary', 'filtered', 'full', 'error'],
|
||||
description: 'For action=get: preview=structure only, summary=2 items (default), filtered=custom, full=all data, error=optimized error debugging'
|
||||
},
|
||||
nodeNames: {
|
||||
type: 'array',
|
||||
@@ -352,6 +352,22 @@ exports.n8nManagementTools = [
|
||||
type: 'boolean',
|
||||
description: 'For action=get: include input data in addition to output (default: false)'
|
||||
},
|
||||
errorItemsLimit: {
|
||||
type: 'number',
|
||||
description: 'For action=get with mode=error: sample items from upstream node (default: 2, max: 100)'
|
||||
},
|
||||
includeStackTrace: {
|
||||
type: 'boolean',
|
||||
description: 'For action=get with mode=error: include full stack trace (default: false, shows truncated)'
|
||||
},
|
||||
includeExecutionPath: {
|
||||
type: 'boolean',
|
||||
description: 'For action=get with mode=error: include execution path leading to error (default: true)'
|
||||
},
|
||||
fetchWorkflow: {
|
||||
type: 'boolean',
|
||||
description: 'For action=get with mode=error: fetch workflow for accurate upstream detection (default: true)'
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
description: 'For action=list: number of executions to return (1-100, default: 100)'
|
||||
|
||||
2
dist/mcp/tools-n8n-manager.js.map
vendored
2
dist/mcp/tools-n8n-manager.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/services/execution-processor.d.ts
vendored
6
dist/services/execution-processor.d.ts
vendored
@@ -1,8 +1,8 @@
|
||||
import { Execution, ExecutionPreview, ExecutionRecommendation, ExecutionFilterOptions, FilteredExecutionResponse } from '../types/n8n-api';
|
||||
import { Execution, ExecutionPreview, ExecutionRecommendation, ExecutionFilterOptions, FilteredExecutionResponse, Workflow } from '../types/n8n-api';
|
||||
export declare function generatePreview(execution: Execution): {
|
||||
preview: ExecutionPreview;
|
||||
recommendation: ExecutionRecommendation;
|
||||
};
|
||||
export declare function filterExecutionData(execution: Execution, options: ExecutionFilterOptions): FilteredExecutionResponse;
|
||||
export declare function processExecution(execution: Execution, options?: ExecutionFilterOptions): FilteredExecutionResponse | Execution;
|
||||
export declare function filterExecutionData(execution: Execution, options: ExecutionFilterOptions, workflow?: Workflow): FilteredExecutionResponse;
|
||||
export declare function processExecution(execution: Execution, options?: ExecutionFilterOptions, workflow?: Workflow): FilteredExecutionResponse | Execution;
|
||||
//# sourceMappingURL=execution-processor.d.ts.map
|
||||
2
dist/services/execution-processor.d.ts.map
vendored
2
dist/services/execution-processor.d.ts.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"execution-processor.d.ts","sourceRoot":"","sources":["../../src/services/execution-processor.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,SAAS,EAET,gBAAgB,EAEhB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EAG1B,MAAM,kBAAkB,CAAC;AA+G1B,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG;IACrD,OAAO,EAAE,gBAAgB,CAAC;IAC1B,cAAc,EAAE,uBAAuB,CAAC;CACzC,CA2EA;AAoID,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,sBAAsB,GAC9B,yBAAyB,CA2J3B;AAMD,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,sBAA2B,GACnC,yBAAyB,GAAG,SAAS,CAOvC"}
|
||||
{"version":3,"file":"execution-processor.d.ts","sourceRoot":"","sources":["../../src/services/execution-processor.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,SAAS,EAET,gBAAgB,EAEhB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EAGzB,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAgH1B,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG;IACrD,OAAO,EAAE,gBAAgB,CAAC;IAC1B,cAAc,EAAE,uBAAuB,CAAC;CACzC,CA2EA;AAoID,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,CAAC,EAAE,QAAQ,GAClB,yBAAyB,CAsL3B;AAMD,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,EACpB,OAAO,GAAE,sBAA2B,EACpC,QAAQ,CAAC,EAAE,QAAQ,GAClB,yBAAyB,GAAG,SAAS,CAOvC"}
|
||||
28
dist/services/execution-processor.js
vendored
28
dist/services/execution-processor.js
vendored
@@ -4,6 +4,7 @@ exports.generatePreview = generatePreview;
|
||||
exports.filterExecutionData = filterExecutionData;
|
||||
exports.processExecution = processExecution;
|
||||
const logger_1 = require("../utils/logger");
|
||||
const error_execution_processor_1 = require("./error-execution-processor");
|
||||
const THRESHOLDS = {
|
||||
CHAR_SIZE_BYTES: 2,
|
||||
OVERHEAD_PER_OBJECT: 50,
|
||||
@@ -231,7 +232,7 @@ function truncateItems(items, limit) {
|
||||
},
|
||||
};
|
||||
}
|
||||
function filterExecutionData(execution, options) {
|
||||
function filterExecutionData(execution, options, workflow) {
|
||||
const mode = options.mode || 'summary';
|
||||
let itemsLimit = options.itemsLimit !== undefined ? options.itemsLimit : 2;
|
||||
if (itemsLimit !== -1) {
|
||||
@@ -265,6 +266,27 @@ function filterExecutionData(execution, options) {
|
||||
response.recommendation = recommendation;
|
||||
return response;
|
||||
}
|
||||
if (mode === 'error') {
|
||||
const errorAnalysis = (0, error_execution_processor_1.processErrorExecution)(execution, {
|
||||
itemsLimit: options.errorItemsLimit ?? 2,
|
||||
includeStackTrace: options.includeStackTrace ?? false,
|
||||
includeExecutionPath: options.includeExecutionPath !== false,
|
||||
workflow
|
||||
});
|
||||
const runData = execution.data?.resultData?.runData || {};
|
||||
const executedNodes = Object.keys(runData).length;
|
||||
response.errorInfo = errorAnalysis;
|
||||
response.summary = {
|
||||
totalNodes: executedNodes,
|
||||
executedNodes,
|
||||
totalItems: 0,
|
||||
hasMoreData: false
|
||||
};
|
||||
if (execution.data?.resultData?.error) {
|
||||
response.error = execution.data.resultData.error;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
if (!execution.data?.resultData?.runData) {
|
||||
response.summary = {
|
||||
totalNodes: 0,
|
||||
@@ -350,10 +372,10 @@ function filterExecutionData(execution, options) {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
function processExecution(execution, options = {}) {
|
||||
function processExecution(execution, options = {}, workflow) {
|
||||
if (!options.mode && !options.nodeNames && options.itemsLimit === undefined) {
|
||||
return execution;
|
||||
}
|
||||
return filterExecutionData(execution, options);
|
||||
return filterExecutionData(execution, options, workflow);
|
||||
}
|
||||
//# sourceMappingURL=execution-processor.js.map
|
||||
2
dist/services/execution-processor.js.map
vendored
2
dist/services/execution-processor.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/services/n8n-validation.d.ts.map
vendored
2
dist/services/n8n-validation.d.ts.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"n8n-validation.d.ts","sourceRoot":"","sources":["../../src/services/n8n-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAM9E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB7B,CAAC;AAkBH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUpC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWjC,CAAC;AAGH,eAAO,MAAM,uBAAuB;;;;;;CAMnC,CAAC;AAGF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAE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,CA6CpD;AAGD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAmBpE"}
|
||||
28
dist/services/n8n-validation.js
vendored
28
dist/services/n8n-validation.js
vendored
@@ -152,17 +152,23 @@ function validateWorkflowStructure(workflow) {
|
||||
}
|
||||
else if (connectionCount > 0 || executableNodes.length > 1) {
|
||||
const connectedNodes = new Set();
|
||||
const ALL_CONNECTION_TYPES = ['main', 'error', 'ai_tool', 'ai_languageModel', 'ai_memory', 'ai_embedding', 'ai_vectorStore'];
|
||||
Object.entries(workflow.connections).forEach(([sourceName, connection]) => {
|
||||
connectedNodes.add(sourceName);
|
||||
if (connection.main && Array.isArray(connection.main)) {
|
||||
connection.main.forEach((outputs) => {
|
||||
if (Array.isArray(outputs)) {
|
||||
outputs.forEach((target) => {
|
||||
connectedNodes.add(target.node);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
ALL_CONNECTION_TYPES.forEach(connType => {
|
||||
const connData = connection[connType];
|
||||
if (connData && Array.isArray(connData)) {
|
||||
connData.forEach((outputs) => {
|
||||
if (Array.isArray(outputs)) {
|
||||
outputs.forEach((target) => {
|
||||
if (target?.node) {
|
||||
connectedNodes.add(target.node);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
const disconnectedNodes = workflow.nodes.filter(node => {
|
||||
if ((0, node_classification_1.isNonExecutableNode)(node.type)) {
|
||||
@@ -171,7 +177,9 @@ function validateWorkflowStructure(workflow) {
|
||||
const isConnected = connectedNodes.has(node.name);
|
||||
const isNodeTrigger = (0, node_type_utils_1.isTriggerNode)(node.type);
|
||||
if (isNodeTrigger) {
|
||||
return !workflow.connections?.[node.name];
|
||||
const hasOutgoingConnections = !!workflow.connections?.[node.name];
|
||||
const hasInboundConnections = isConnected;
|
||||
return !hasOutgoingConnections && !hasInboundConnections;
|
||||
}
|
||||
return !isConnected;
|
||||
});
|
||||
|
||||
2
dist/services/n8n-validation.js.map
vendored
2
dist/services/n8n-validation.js.map
vendored
File diff suppressed because one or more lines are too long
41
dist/types/n8n-api.d.ts
vendored
41
dist/types/n8n-api.d.ts
vendored
@@ -267,7 +267,7 @@ export interface McpToolResponse {
|
||||
executionId?: string;
|
||||
workflowId?: string;
|
||||
}
|
||||
export type ExecutionMode = 'preview' | 'summary' | 'filtered' | 'full';
|
||||
export type ExecutionMode = 'preview' | 'summary' | 'filtered' | 'full' | 'error';
|
||||
export interface ExecutionPreview {
|
||||
totalNodes: number;
|
||||
executedNodes: number;
|
||||
@@ -296,6 +296,9 @@ export interface ExecutionFilterOptions {
|
||||
itemsLimit?: number;
|
||||
includeInputData?: boolean;
|
||||
fieldsToInclude?: string[];
|
||||
errorItemsLimit?: number;
|
||||
includeStackTrace?: boolean;
|
||||
includeExecutionPath?: boolean;
|
||||
}
|
||||
export interface FilteredExecutionResponse {
|
||||
id: string;
|
||||
@@ -316,6 +319,7 @@ export interface FilteredExecutionResponse {
|
||||
};
|
||||
nodes?: Record<string, FilteredNodeData>;
|
||||
error?: Record<string, unknown>;
|
||||
errorInfo?: ErrorAnalysis;
|
||||
}
|
||||
export interface FilteredNodeData {
|
||||
executionTime?: number;
|
||||
@@ -333,4 +337,39 @@ export interface FilteredNodeData {
|
||||
};
|
||||
};
|
||||
}
|
||||
export interface ErrorAnalysis {
|
||||
primaryError: {
|
||||
message: string;
|
||||
errorType: string;
|
||||
nodeName: string;
|
||||
nodeType: string;
|
||||
nodeId?: string;
|
||||
nodeParameters?: Record<string, unknown>;
|
||||
stackTrace?: string;
|
||||
};
|
||||
upstreamContext?: {
|
||||
nodeName: string;
|
||||
nodeType: string;
|
||||
itemCount: number;
|
||||
sampleItems: unknown[];
|
||||
dataStructure: Record<string, unknown>;
|
||||
};
|
||||
executionPath?: Array<{
|
||||
nodeName: string;
|
||||
status: 'success' | 'error' | 'skipped';
|
||||
itemCount: number;
|
||||
executionTime?: number;
|
||||
}>;
|
||||
additionalErrors?: Array<{
|
||||
nodeName: string;
|
||||
message: string;
|
||||
}>;
|
||||
suggestions?: ErrorSuggestion[];
|
||||
}
|
||||
export interface ErrorSuggestion {
|
||||
type: 'fix' | 'investigate' | 'workaround';
|
||||
title: string;
|
||||
description: string;
|
||||
confidence: 'high' | 'medium' | 'low';
|
||||
}
|
||||
//# sourceMappingURL=n8n-api.d.ts.map
|
||||
2
dist/types/n8n-api.d.ts.map
vendored
2
dist/types/n8n-api.d.ts.map
vendored
File diff suppressed because one or more lines are too long
598
package-lock.json
generated
598
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "n8n-mcp",
|
||||
"version": "2.31.0",
|
||||
"version": "2.31.3",
|
||||
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -141,16 +141,16 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "1.20.1",
|
||||
"@n8n/n8n-nodes-langchain": "^2.0.1",
|
||||
"@n8n/n8n-nodes-langchain": "^2.1.3",
|
||||
"@supabase/supabase-js": "^2.57.4",
|
||||
"dotenv": "^16.5.0",
|
||||
"express": "^5.1.0",
|
||||
"express-rate-limit": "^7.1.5",
|
||||
"form-data": "^4.0.5",
|
||||
"lru-cache": "^11.2.1",
|
||||
"n8n": "^2.0.2",
|
||||
"n8n-core": "^2.0.1",
|
||||
"n8n-workflow": "^2.0.1",
|
||||
"n8n": "^2.1.4",
|
||||
"n8n-core": "^2.1.3",
|
||||
"n8n-workflow": "^2.1.1",
|
||||
"openai": "^4.77.0",
|
||||
"sql.js": "^1.13.0",
|
||||
"tslib": "^2.6.2",
|
||||
|
||||
@@ -42,7 +42,7 @@ export const getTemplateDoc: ToolDocumentation = {
|
||||
- url: Link to template on n8n.io
|
||||
- workflow: Complete workflow JSON with structure:
|
||||
- nodes: Array of node objects (id, name, type, typeVersion, position, parameters)
|
||||
- connections: Object mapping source nodes to targets
|
||||
- connections: Object mapping source node names to targets
|
||||
- settings: Workflow configuration (timezone, error handling, etc.)
|
||||
- usage: Instructions for using the workflow`,
|
||||
examples: [
|
||||
|
||||
@@ -20,7 +20,7 @@ export const n8nCreateWorkflowDoc: ToolDocumentation = {
|
||||
parameters: {
|
||||
name: { type: 'string', required: true, description: 'Workflow name' },
|
||||
nodes: { type: 'array', required: true, description: 'Array of nodes with id, name, type, typeVersion, position, parameters' },
|
||||
connections: { type: 'object', required: true, description: 'Node connections. Keys are source node IDs' },
|
||||
connections: { type: 'object', required: true, description: 'Node connections. Keys are source node names (not IDs)' },
|
||||
settings: { type: 'object', description: 'Optional workflow settings (timezone, error handling, etc.)' }
|
||||
},
|
||||
returns: 'Minimal summary (id, name, active, nodeCount) for token efficiency. Use n8n_get_workflow with mode "structure" to verify current state if needed.',
|
||||
@@ -55,8 +55,8 @@ n8n_create_workflow({
|
||||
}
|
||||
],
|
||||
connections: {
|
||||
"webhook_1": {
|
||||
"main": [[{node: "slack_1", type: "main", index: 0}]]
|
||||
"Webhook": {
|
||||
"main": [[{node: "Slack", type: "main", index: 0}]]
|
||||
}
|
||||
}
|
||||
})`,
|
||||
|
||||
@@ -46,9 +46,9 @@ export const n8nManagementTools: ToolDefinition[] = [
|
||||
}
|
||||
}
|
||||
},
|
||||
connections: {
|
||||
type: 'object',
|
||||
description: 'Workflow connections object. Keys are source node IDs, values define output connections'
|
||||
connections: {
|
||||
type: 'object',
|
||||
description: 'Workflow connections object. Keys are source node names (the name field, not id), values define output connections'
|
||||
},
|
||||
settings: {
|
||||
type: 'object',
|
||||
|
||||
@@ -248,23 +248,32 @@ export function validateWorkflowStructure(workflow: Partial<Workflow>): string[]
|
||||
const connectedNodes = new Set<string>();
|
||||
|
||||
// Collect all nodes that appear in connections (as source or target)
|
||||
// Check ALL connection types, not just 'main' - AI workflows use ai_tool, ai_languageModel, etc.
|
||||
const ALL_CONNECTION_TYPES = ['main', 'error', 'ai_tool', 'ai_languageModel', 'ai_memory', 'ai_embedding', 'ai_vectorStore'] as const;
|
||||
|
||||
Object.entries(workflow.connections).forEach(([sourceName, connection]) => {
|
||||
connectedNodes.add(sourceName); // Node has outgoing connection
|
||||
|
||||
if (connection.main && Array.isArray(connection.main)) {
|
||||
connection.main.forEach((outputs) => {
|
||||
if (Array.isArray(outputs)) {
|
||||
outputs.forEach((target) => {
|
||||
connectedNodes.add(target.node); // Node has incoming connection
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// Check all connection types for target nodes
|
||||
ALL_CONNECTION_TYPES.forEach(connType => {
|
||||
const connData = (connection as Record<string, unknown>)[connType];
|
||||
if (connData && Array.isArray(connData)) {
|
||||
connData.forEach((outputs) => {
|
||||
if (Array.isArray(outputs)) {
|
||||
outputs.forEach((target: { node: string }) => {
|
||||
if (target?.node) {
|
||||
connectedNodes.add(target.node); // Node has incoming connection
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Find disconnected nodes (excluding non-executable nodes and triggers)
|
||||
// Non-executable nodes (sticky notes) are UI-only and don't need connections
|
||||
// Trigger nodes only need outgoing connections
|
||||
// Trigger nodes need either outgoing connections OR inbound AI connections (for mcpTrigger)
|
||||
const disconnectedNodes = workflow.nodes.filter(node => {
|
||||
// Skip non-executable nodes (sticky notes, etc.) - they're UI-only annotations
|
||||
if (isNonExecutableNode(node.type)) {
|
||||
@@ -274,9 +283,12 @@ export function validateWorkflowStructure(workflow: Partial<Workflow>): string[]
|
||||
const isConnected = connectedNodes.has(node.name);
|
||||
const isNodeTrigger = isTriggerNode(node.type);
|
||||
|
||||
// Trigger nodes only need outgoing connections
|
||||
// Trigger nodes need outgoing connections OR inbound connections (for mcpTrigger)
|
||||
// mcpTrigger is special: it has "trigger" in its name but only receives inbound ai_tool connections
|
||||
if (isNodeTrigger) {
|
||||
return !workflow.connections?.[node.name]; // Disconnected if no outgoing connections
|
||||
const hasOutgoingConnections = !!workflow.connections?.[node.name];
|
||||
const hasInboundConnections = isConnected;
|
||||
return !hasOutgoingConnections && !hasInboundConnections; // Disconnected if NEITHER
|
||||
}
|
||||
|
||||
// Regular nodes need at least one connection (incoming or outgoing)
|
||||
|
||||
@@ -884,6 +884,260 @@ describe('n8n-validation', () => {
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
expect(errors.some(e => e.includes('Invalid connections'))).toBe(true);
|
||||
});
|
||||
|
||||
// Issue #503: mcpTrigger nodes should not be flagged as disconnected
|
||||
describe('AI connection types (Issue #503)', () => {
|
||||
it('should NOT flag mcpTrigger as disconnected when it has ai_tool inbound connections', () => {
|
||||
const workflow = {
|
||||
name: 'MCP Server Workflow',
|
||||
nodes: [
|
||||
{
|
||||
id: 'mcp-server',
|
||||
name: 'MCP Server',
|
||||
type: '@n8n/n8n-nodes-langchain.mcpTrigger',
|
||||
typeVersion: 1,
|
||||
position: [500, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'tool-1',
|
||||
name: 'Get Weather Tool',
|
||||
type: '@n8n/n8n-nodes-langchain.toolWorkflow',
|
||||
typeVersion: 1.3,
|
||||
position: [300, 200] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'tool-2',
|
||||
name: 'Search Tool',
|
||||
type: '@n8n/n8n-nodes-langchain.toolWorkflow',
|
||||
typeVersion: 1.3,
|
||||
position: [300, 400] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
'Get Weather Tool': {
|
||||
ai_tool: [[{ node: 'MCP Server', type: 'ai_tool', index: 0 }]],
|
||||
},
|
||||
'Search Tool': {
|
||||
ai_tool: [[{ node: 'MCP Server', type: 'ai_tool', index: 0 }]],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
const disconnectedErrors = errors.filter(e => e.includes('Disconnected'));
|
||||
expect(disconnectedErrors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should NOT flag nodes as disconnected when connected via ai_languageModel', () => {
|
||||
const workflow = {
|
||||
name: 'AI Agent Workflow',
|
||||
nodes: [
|
||||
{
|
||||
id: 'agent-1',
|
||||
name: 'AI Agent',
|
||||
type: '@n8n/n8n-nodes-langchain.agent',
|
||||
typeVersion: 1.6,
|
||||
position: [500, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'llm-1',
|
||||
name: 'OpenAI Model',
|
||||
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
||||
typeVersion: 1,
|
||||
position: [300, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
'OpenAI Model': {
|
||||
ai_languageModel: [[{ node: 'AI Agent', type: 'ai_languageModel', index: 0 }]],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
const disconnectedErrors = errors.filter(e => e.includes('Disconnected'));
|
||||
expect(disconnectedErrors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should NOT flag nodes as disconnected when connected via ai_memory', () => {
|
||||
const workflow = {
|
||||
name: 'AI Memory Workflow',
|
||||
nodes: [
|
||||
{
|
||||
id: 'agent-1',
|
||||
name: 'AI Agent',
|
||||
type: '@n8n/n8n-nodes-langchain.agent',
|
||||
typeVersion: 1.6,
|
||||
position: [500, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'memory-1',
|
||||
name: 'Buffer Memory',
|
||||
type: '@n8n/n8n-nodes-langchain.memoryBufferWindow',
|
||||
typeVersion: 1,
|
||||
position: [300, 400] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
'Buffer Memory': {
|
||||
ai_memory: [[{ node: 'AI Agent', type: 'ai_memory', index: 0 }]],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
const disconnectedErrors = errors.filter(e => e.includes('Disconnected'));
|
||||
expect(disconnectedErrors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should NOT flag nodes as disconnected when connected via ai_embedding', () => {
|
||||
const workflow = {
|
||||
name: 'Vector Store Workflow',
|
||||
nodes: [
|
||||
{
|
||||
id: 'vs-1',
|
||||
name: 'Vector Store',
|
||||
type: '@n8n/n8n-nodes-langchain.vectorStorePinecone',
|
||||
typeVersion: 1,
|
||||
position: [500, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'embed-1',
|
||||
name: 'OpenAI Embeddings',
|
||||
type: '@n8n/n8n-nodes-langchain.embeddingsOpenAi',
|
||||
typeVersion: 1,
|
||||
position: [300, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
'OpenAI Embeddings': {
|
||||
ai_embedding: [[{ node: 'Vector Store', type: 'ai_embedding', index: 0 }]],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
const disconnectedErrors = errors.filter(e => e.includes('Disconnected'));
|
||||
expect(disconnectedErrors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should NOT flag nodes as disconnected when connected via ai_vectorStore', () => {
|
||||
const workflow = {
|
||||
name: 'Retriever Workflow',
|
||||
nodes: [
|
||||
{
|
||||
id: 'retriever-1',
|
||||
name: 'Vector Store Retriever',
|
||||
type: '@n8n/n8n-nodes-langchain.retrieverVectorStore',
|
||||
typeVersion: 1,
|
||||
position: [500, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'vs-1',
|
||||
name: 'Pinecone Store',
|
||||
type: '@n8n/n8n-nodes-langchain.vectorStorePinecone',
|
||||
typeVersion: 1,
|
||||
position: [300, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
'Pinecone Store': {
|
||||
ai_vectorStore: [[{ node: 'Vector Store Retriever', type: 'ai_vectorStore', index: 0 }]],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
const disconnectedErrors = errors.filter(e => e.includes('Disconnected'));
|
||||
expect(disconnectedErrors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should NOT flag nodes as disconnected when connected via error output', () => {
|
||||
const workflow = {
|
||||
name: 'Error Handling Workflow',
|
||||
nodes: [
|
||||
{
|
||||
id: 'http-1',
|
||||
name: 'HTTP Request',
|
||||
type: 'n8n-nodes-base.httpRequest',
|
||||
typeVersion: 4.2,
|
||||
position: [300, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'set-1',
|
||||
name: 'Handle Error',
|
||||
type: 'n8n-nodes-base.set',
|
||||
typeVersion: 3.4,
|
||||
position: [500, 400] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
'HTTP Request': {
|
||||
error: [[{ node: 'Handle Error', type: 'error', index: 0 }]],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
const disconnectedErrors = errors.filter(e => e.includes('Disconnected'));
|
||||
expect(disconnectedErrors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should still flag truly disconnected nodes in AI workflows', () => {
|
||||
const workflow = {
|
||||
name: 'AI Workflow with Disconnected Node',
|
||||
nodes: [
|
||||
{
|
||||
id: 'agent-1',
|
||||
name: 'AI Agent',
|
||||
type: '@n8n/n8n-nodes-langchain.agent',
|
||||
typeVersion: 1.6,
|
||||
position: [500, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'llm-1',
|
||||
name: 'OpenAI Model',
|
||||
type: '@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
||||
typeVersion: 1,
|
||||
position: [300, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
{
|
||||
id: 'disconnected-1',
|
||||
name: 'Disconnected Set',
|
||||
type: 'n8n-nodes-base.set',
|
||||
typeVersion: 3.4,
|
||||
position: [700, 300] as [number, number],
|
||||
parameters: {},
|
||||
},
|
||||
],
|
||||
connections: {
|
||||
'OpenAI Model': {
|
||||
ai_languageModel: [[{ node: 'AI Agent', type: 'ai_languageModel', index: 0 }]],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const errors = validateWorkflowStructure(workflow);
|
||||
const disconnectedErrors = errors.filter(e => e.includes('Disconnected'));
|
||||
expect(disconnectedErrors.length).toBeGreaterThan(0);
|
||||
expect(disconnectedErrors[0]).toContain('Disconnected Set');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasWebhookTrigger', () => {
|
||||
|
||||
Reference in New Issue
Block a user