mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-20 17:33:08 +00:00
- Normalize name→nodeName and id→nodeId for node-targeting operations in the Zod schema transform, so LLMs using natural field names no longer get "Node not found" errors - Replace hardcoded ALL_CONNECTION_TYPES with dynamic iteration so AI sub-nodes (ai_outputParser, ai_document, ai_textSplitter, etc.) are not flagged as disconnected during save - Add .catchall() to workflowConnectionSchema and extend connection reference validation to cover all connection types, not just main - Fix filterOperationsByFixes ID-vs-name mismatch: typeversion-upgrade operations now include nodeName alongside nodeId, and the filter checks both fields Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
65ab94deb2
commit
f7a1cfe8bf
37
dist/services/ai-tool-validators.js
vendored
37
dist/services/ai-tool-validators.js
vendored
@@ -21,9 +21,14 @@ const MIN_DESCRIPTION_LENGTH_MEDIUM = 15;
|
||||
const MIN_DESCRIPTION_LENGTH_LONG = 20;
|
||||
const MAX_ITERATIONS_WARNING_THRESHOLD = 50;
|
||||
const MAX_TOPK_WARNING_THRESHOLD = 20;
|
||||
function getToolDescription(node) {
|
||||
return (node.parameters.toolDescription ||
|
||||
node.parameters.description ||
|
||||
node.parameters.options?.description);
|
||||
}
|
||||
function validateHTTPRequestTool(node) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -32,7 +37,7 @@ function validateHTTPRequestTool(node) {
|
||||
code: 'MISSING_TOOL_DESCRIPTION'
|
||||
});
|
||||
}
|
||||
else if (node.parameters.toolDescription.trim().length < MIN_DESCRIPTION_LENGTH_MEDIUM) {
|
||||
else if (getToolDescription(node).trim().length < MIN_DESCRIPTION_LENGTH_MEDIUM) {
|
||||
issues.push({
|
||||
severity: 'warning',
|
||||
nodeId: node.id,
|
||||
@@ -154,7 +159,7 @@ function validateHTTPRequestTool(node) {
|
||||
}
|
||||
function validateCodeTool(node) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -184,7 +189,7 @@ function validateCodeTool(node) {
|
||||
}
|
||||
function validateVectorStoreTool(node, reverseConnections, workflow) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -216,7 +221,7 @@ function validateVectorStoreTool(node, reverseConnections, workflow) {
|
||||
}
|
||||
function validateWorkflowTool(node, reverseConnections) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -238,7 +243,7 @@ function validateWorkflowTool(node, reverseConnections) {
|
||||
}
|
||||
function validateAIAgentTool(node, reverseConnections) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -270,7 +275,7 @@ function validateAIAgentTool(node, reverseConnections) {
|
||||
}
|
||||
function validateMCPClientTool(node) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -290,17 +295,15 @@ function validateMCPClientTool(node) {
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
function validateCalculatorTool(node) {
|
||||
const issues = [];
|
||||
return issues;
|
||||
function validateCalculatorTool(_node) {
|
||||
return [];
|
||||
}
|
||||
function validateThinkTool(node) {
|
||||
const issues = [];
|
||||
return issues;
|
||||
function validateThinkTool(_node) {
|
||||
return [];
|
||||
}
|
||||
function validateSerpApiTool(node) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -321,7 +324,7 @@ function validateSerpApiTool(node) {
|
||||
}
|
||||
function validateWikipediaTool(node) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -345,7 +348,7 @@ function validateWikipediaTool(node) {
|
||||
}
|
||||
function validateSearXngTool(node) {
|
||||
const issues = [];
|
||||
if (!node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'error',
|
||||
nodeId: node.id,
|
||||
@@ -376,7 +379,7 @@ function validateWolframAlphaTool(node) {
|
||||
code: 'MISSING_CREDENTIALS'
|
||||
});
|
||||
}
|
||||
if (!node.parameters.description && !node.parameters.toolDescription) {
|
||||
if (!getToolDescription(node)) {
|
||||
issues.push({
|
||||
severity: 'info',
|
||||
nodeId: node.id,
|
||||
|
||||
Reference in New Issue
Block a user