mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-08 06:13:07 +00:00
fix: AI connection type propagation and get_node improvements (v2.28.1) (#461)
* fix: AI connection type propagation and get_node improvements (v2.28.1) Bug fixes: - Issue #458: addConnection now preserves AI connection types (ai_tool, ai_memory, ai_languageModel) instead of defaulting to 'main' - Fixed false positive "AI Agent has no tools connected" validation warning Enhancements: - Added expectedFormat field to resourceLocator properties in get_node output - Added versionNotice field to make typeVersion more prominent 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> * test: add missing test coverage for PR #461 improvements - Added test for AI Agent validation positive case (tools properly connected) - Added 3 tests for expectedFormat on resourceLocator properties 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> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
33690c5650
commit
3188d209b7
@@ -1137,16 +1137,23 @@ export class WorkflowValidator {
|
||||
}
|
||||
|
||||
// Check for AI Agent workflows
|
||||
const aiAgentNodes = workflow.nodes.filter(n =>
|
||||
n.type.toLowerCase().includes('agent') ||
|
||||
const aiAgentNodes = workflow.nodes.filter(n =>
|
||||
n.type.toLowerCase().includes('agent') ||
|
||||
n.type.includes('langchain.agent')
|
||||
);
|
||||
|
||||
|
||||
if (aiAgentNodes.length > 0) {
|
||||
// Check if AI agents have tools connected
|
||||
// Tools connect TO the agent, so we need to find connections where the target is the agent
|
||||
for (const agentNode of aiAgentNodes) {
|
||||
const connections = workflow.connections[agentNode.name];
|
||||
if (!connections?.ai_tool || connections.ai_tool.flat().filter(c => c).length === 0) {
|
||||
// Search all connections to find ones targeting this agent via ai_tool
|
||||
const hasToolConnected = Object.values(workflow.connections).some(sourceOutputs => {
|
||||
const aiToolConnections = sourceOutputs.ai_tool;
|
||||
if (!aiToolConnections) return false;
|
||||
return aiToolConnections.flat().some(conn => conn && conn.node === agentNode.name);
|
||||
});
|
||||
|
||||
if (!hasToolConnected) {
|
||||
result.warnings.push({
|
||||
type: 'warning',
|
||||
nodeId: agentNode.id,
|
||||
|
||||
Reference in New Issue
Block a user