mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 05:23:08 +00:00
* perf: optimize workflow tool responses for token efficiency (v2.29.0)
Reduce response sizes by 75-90% for 4 workflow management tools:
- n8n_update_partial_workflow: Returns {id, name, active, operationsApplied}
- n8n_create_workflow: Returns {id, name, active, nodeCount}
- n8n_update_full_workflow: Returns {id, name, active, nodeCount}
- n8n_delete_workflow: Returns {id, name, deleted: true}
AI agents can use n8n_get_workflow with mode 'structure' if they need
to verify the current workflow state after operations.
Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: update tests and add nodeCount to partial update response
- Fix handleCreateWorkflow test to expect minimal response
- Fix handleDeleteWorkflow test to expect minimal response
- Add nodeCount to n8n_update_partial_workflow response for consistency
- Update documentation and CHANGELOG
Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: update handlers-workflow-diff tests for minimal response
Update 3 more tests that expected full workflow in response:
- should apply diff operations successfully
- should activate workflow after successful update
- should deactivate workflow after successful update
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: update integration tests to use minimal response format
Integration tests now verify minimal response format and use
client.getWorkflow() to fetch actual workflow state for verification.
Conceived by Romuald Czlonkowski - www.aiadvisors.pl/en
* fix: update create/update workflow integration tests for minimal response
Integration tests now verify minimal response and use client.getWorkflow()
to fetch actual workflow state for detailed verification.
Conceived by Romuald Czlonkowski - www.aiadvisors.pl/en
* fix: add type assertions to fix TypeScript errors in tests
Conceived by Romuald Czlonkowski - www.aiadvisors.pl/en
---------
Co-authored-by: Romuald Członkowski <romualdczlonkowski@MacBook-Pro-Romuald.local>
Co-authored-by: Claude <noreply@anthropic.com>
102 lines
4.1 KiB
JavaScript
102 lines
4.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.n8nCreateWorkflowDoc = void 0;
|
|
exports.n8nCreateWorkflowDoc = {
|
|
name: 'n8n_create_workflow',
|
|
category: 'workflow_management',
|
|
essentials: {
|
|
description: 'Create workflow. Requires: name, nodes[], connections{}. Created inactive. Returns workflow with ID.',
|
|
keyParameters: ['name', 'nodes', 'connections'],
|
|
example: 'n8n_create_workflow({name: "My Flow", nodes: [...], connections: {...}})',
|
|
performance: 'Network-dependent',
|
|
tips: [
|
|
'Workflow created inactive',
|
|
'Returns ID for future updates',
|
|
'Validate first with validate_workflow',
|
|
'Auto-sanitization fixes operator structures and missing metadata during creation'
|
|
]
|
|
},
|
|
full: {
|
|
description: 'Creates a new workflow in n8n with specified nodes and connections. Workflow is created in inactive state. Each node requires: id, name, type, typeVersion, position, and parameters.',
|
|
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' },
|
|
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.',
|
|
examples: [
|
|
`// Basic webhook to Slack workflow
|
|
n8n_create_workflow({
|
|
name: "Webhook to Slack",
|
|
nodes: [
|
|
{
|
|
id: "webhook_1",
|
|
name: "Webhook",
|
|
type: "n8n-nodes-base.webhook",
|
|
typeVersion: 1,
|
|
position: [250, 300],
|
|
parameters: {
|
|
httpMethod: "POST",
|
|
path: "slack-notify"
|
|
}
|
|
},
|
|
{
|
|
id: "slack_1",
|
|
name: "Slack",
|
|
type: "n8n-nodes-base.slack",
|
|
typeVersion: 1,
|
|
position: [450, 300],
|
|
parameters: {
|
|
resource: "message",
|
|
operation: "post",
|
|
channel: "#general",
|
|
text: "={{$json.message}}"
|
|
}
|
|
}
|
|
],
|
|
connections: {
|
|
"webhook_1": {
|
|
"main": [[{node: "slack_1", type: "main", index: 0}]]
|
|
}
|
|
}
|
|
})`,
|
|
`// Workflow with settings and error handling
|
|
n8n_create_workflow({
|
|
name: "Data Processing",
|
|
nodes: [...],
|
|
connections: {...},
|
|
settings: {
|
|
timezone: "America/New_York",
|
|
errorWorkflow: "error_handler_workflow_id",
|
|
saveDataSuccessExecution: "all",
|
|
saveDataErrorExecution: "all"
|
|
}
|
|
})`
|
|
],
|
|
useCases: [
|
|
'Deploy validated workflows',
|
|
'Automate workflow creation',
|
|
'Clone workflow structures',
|
|
'Template deployment'
|
|
],
|
|
performance: 'Network-dependent - Typically 100-500ms depending on workflow size',
|
|
bestPractices: [
|
|
'Validate with validate_workflow first',
|
|
'Use unique node IDs',
|
|
'Position nodes for readability',
|
|
'Test with n8n_test_workflow'
|
|
],
|
|
pitfalls: [
|
|
'**REQUIRES N8N_API_URL and N8N_API_KEY environment variables** - tool unavailable without n8n API access',
|
|
'Workflows created in INACTIVE state - must activate separately',
|
|
'Node IDs must be unique within workflow',
|
|
'Credentials must be configured separately in n8n',
|
|
'Node type names must include package prefix (e.g., "n8n-nodes-base.slack")',
|
|
'**Auto-sanitization runs on creation**: All nodes sanitized before workflow created (operator structures fixed, missing metadata added)',
|
|
'**Auto-sanitization cannot prevent all failures**: Broken connections or invalid node configurations may still cause creation to fail'
|
|
],
|
|
relatedTools: ['validate_workflow', 'n8n_update_partial_workflow', 'n8n_test_workflow']
|
|
}
|
|
};
|
|
//# sourceMappingURL=n8n-create-workflow.js.map
|