Files
n8n-mcp/dist/services/ai-tool-validators.d.ts
Romuald Członkowski f7a1cfe8bf fix: field normalization, AI connection validation, autofix filter (#581) (#638)
- 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>
2026-03-15 14:32:14 +01:00

58 lines
3.0 KiB
TypeScript

export interface WorkflowNode {
id: string;
name: string;
type: string;
position: [number, number];
parameters: any;
credentials?: any;
disabled?: boolean;
typeVersion?: number;
}
export interface WorkflowJson {
name?: string;
nodes: WorkflowNode[];
connections: Record<string, any>;
settings?: any;
}
export interface ReverseConnection {
sourceName: string;
sourceType: string;
type: string;
index: number;
}
export interface ValidationIssue {
severity: 'error' | 'warning' | 'info';
nodeId?: string;
nodeName?: string;
message: string;
code?: string;
}
export declare function validateHTTPRequestTool(node: WorkflowNode): ValidationIssue[];
export declare function validateCodeTool(node: WorkflowNode): ValidationIssue[];
export declare function validateVectorStoreTool(node: WorkflowNode, reverseConnections: Map<string, ReverseConnection[]>, workflow: WorkflowJson): ValidationIssue[];
export declare function validateWorkflowTool(node: WorkflowNode, reverseConnections?: Map<string, ReverseConnection[]>): ValidationIssue[];
export declare function validateAIAgentTool(node: WorkflowNode, reverseConnections: Map<string, ReverseConnection[]>): ValidationIssue[];
export declare function validateMCPClientTool(node: WorkflowNode): ValidationIssue[];
export declare function validateCalculatorTool(_node: WorkflowNode): ValidationIssue[];
export declare function validateThinkTool(_node: WorkflowNode): ValidationIssue[];
export declare function validateSerpApiTool(node: WorkflowNode): ValidationIssue[];
export declare function validateWikipediaTool(node: WorkflowNode): ValidationIssue[];
export declare function validateSearXngTool(node: WorkflowNode): ValidationIssue[];
export declare function validateWolframAlphaTool(node: WorkflowNode): ValidationIssue[];
export declare const AI_TOOL_VALIDATORS: {
readonly 'nodes-langchain.toolHttpRequest': typeof validateHTTPRequestTool;
readonly 'nodes-langchain.toolCode': typeof validateCodeTool;
readonly 'nodes-langchain.toolVectorStore': typeof validateVectorStoreTool;
readonly 'nodes-langchain.toolWorkflow': typeof validateWorkflowTool;
readonly 'nodes-langchain.agentTool': typeof validateAIAgentTool;
readonly 'nodes-langchain.mcpClientTool': typeof validateMCPClientTool;
readonly 'nodes-langchain.toolCalculator': typeof validateCalculatorTool;
readonly 'nodes-langchain.toolThink': typeof validateThinkTool;
readonly 'nodes-langchain.toolSerpApi': typeof validateSerpApiTool;
readonly 'nodes-langchain.toolWikipedia': typeof validateWikipediaTool;
readonly 'nodes-langchain.toolSearXng': typeof validateSearXngTool;
readonly 'nodes-langchain.toolWolframAlpha': typeof validateWolframAlphaTool;
};
export declare function isAIToolSubNode(nodeType: string): boolean;
export declare function validateAIToolSubNode(node: WorkflowNode, nodeType: string, reverseConnections: Map<string, ReverseConnection[]>, workflow: WorkflowJson): ValidationIssue[];
//# sourceMappingURL=ai-tool-validators.d.ts.map