Files
n8n-mcp/src/mcp/tool-docs/validation/validate-node.ts
Romuald Członkowski 1be06c217f fix: synchronize tool documentation with v2.26.0 tool consolidation (v2.26.2) (#442)
* fix: synchronize tool documentation with v2.26.0 tool consolidation (v2.26.2)

- Delete 23 obsolete documentation files for removed tools
- Create consolidated documentation for get_node, validate_node, n8n_executions
- Update search_templates with all searchModes
- Update n8n_get_workflow with all modes
- Fix stale relatedTools references
- Update tools-documentation.ts overview to reflect 19 consolidated tools

Conceived by Romuald Członkowski - www.aiadvisors.pl/en

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: address code review - fix remaining stale tool references

- Fix relatedTools in system/tools-documentation.ts (get_node_for_task → search_templates)
- Fix relatedTools in validation/validate-workflow.ts (remove references to removed tools)
- Fix relatedTools in n8n-autofix-workflow.ts (remove references to removed tools)
- Update tools-n8n-friendly.ts with consolidated tools (validate_node, get_node, search_templates)

Conceived by Romuald Członkowski - www.aiadvisors.pl/en

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: address final code review - fix remaining stale references

- Fix ai-agents-guide.ts: get_node_essentials → get_node, remove list_ai_tools
- Fix get-template.ts: list_node_templates → search_templates, remove get_templates_for_task
- Fix n8n-list-workflows.ts: n8n_get_workflow_minimal → n8n_get_workflow, n8n_list_executions → n8n_executions
- Fix n8n-trigger-webhook-workflow.ts: n8n_get_execution/n8n_list_executions → n8n_executions
- Fix n8n-delete-workflow.ts: n8n_get_workflow_minimal → n8n_get_workflow, n8n_delete_execution → n8n_executions
- Fix CHANGELOG date typo: 2025-01-25 → 2025-11-25

Conceived by Romuald Członkowski - www.aiadvisors.pl/en

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: adjust comprehensive docs threshold after tool consolidation

Reduce expected character count from 5000 to 4000 in tool-invocation.test.ts
to account for reduced documentation after v2.26.0 tool consolidation
(31→19 tools, actual output is ~4645 chars).

Conceived by Romuald Członkowski - 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>
2025-11-25 21:28:11 +01:00

83 lines
4.5 KiB
TypeScript

import { ToolDocumentation } from '../types';
export const validateNodeDoc: ToolDocumentation = {
name: 'validate_node',
category: 'validation',
essentials: {
description: 'Validate n8n node configuration. Use mode="full" for comprehensive validation with errors/warnings/suggestions, mode="minimal" for quick required fields check.',
keyParameters: ['nodeType', 'config', 'mode', 'profile'],
example: 'validate_node({nodeType: "nodes-base.slack", config: {resource: "channel", operation: "create"}})',
performance: 'Fast (<100ms)',
tips: [
'Always call get_node({detail:"standard"}) first to see required fields',
'Use mode="minimal" for quick checks during development',
'Use mode="full" with profile="strict" before production deployment',
'Includes automatic structure validation for filter, resourceMapper, etc.'
]
},
full: {
description: `Unified node configuration validator. Replaces validate_node_operation and validate_node_minimal with a single tool.
**Validation Modes:**
- full (default): Comprehensive validation with errors, warnings, suggestions, and automatic structure validation
- minimal: Quick check for required fields only - fast but less thorough
**Validation Profiles (for mode="full"):**
- minimal: Very lenient, basic checks only
- runtime: Standard validation (default)
- ai-friendly: Balanced for AI agent workflows
- strict: Most thorough, recommended for production
**Automatic Structure Validation:**
Validates complex n8n types automatically:
- filter (FilterValue): 40+ operations (equals, contains, regex, etc.)
- resourceMapper (ResourceMapperValue): Data mapping configuration
- assignmentCollection (AssignmentCollectionValue): Variable assignments
- resourceLocator (INodeParameterResourceLocator): Resource selection modes`,
parameters: {
nodeType: { type: 'string', required: true, description: 'Node type with prefix: "nodes-base.slack"' },
config: { type: 'object', required: true, description: 'Configuration object to validate. Use {} for empty config' },
mode: { type: 'string', required: false, description: 'Validation mode: "full" (default) or "minimal"' },
profile: { type: 'string', required: false, description: 'Validation profile for mode=full: "minimal", "runtime" (default), "ai-friendly", "strict"' }
},
returns: `Object containing:
- nodeType: The validated node type
- workflowNodeType: Type to use in workflow JSON
- displayName: Human-readable node name
- valid: Boolean indicating if configuration is valid
- errors: Array of error objects with type, property, message, fix
- warnings: Array of warning objects with suggestions
- suggestions: Array of improvement suggestions
- missingRequiredFields: (mode=minimal only) Array of missing required field names
- summary: Object with hasErrors, errorCount, warningCount, suggestionCount`,
examples: [
'// Full validation with default profile\nvalidate_node({nodeType: "nodes-base.slack", config: {resource: "channel", operation: "create"}})',
'// Quick required fields check\nvalidate_node({nodeType: "nodes-base.webhook", config: {}, mode: "minimal"})',
'// Strict validation for production\nvalidate_node({nodeType: "nodes-base.httpRequest", config: {...}, mode: "full", profile: "strict"})',
'// Validate IF node with filter\nvalidate_node({nodeType: "nodes-base.if", config: {conditions: {combinator: "and", conditions: [...]}}})'
],
useCases: [
'Validate node configuration before adding to workflow',
'Quick check for required fields during development',
'Pre-production validation with strict profile',
'Validate complex structures (filters, resource mappers)',
'Get suggestions for improving node configuration'
],
performance: 'Fast validation: <50ms for minimal mode, <100ms for full mode. Structure validation adds minimal overhead.',
bestPractices: [
'Always call get_node() first to understand required fields',
'Use mode="minimal" for rapid iteration during development',
'Use profile="strict" before deploying to production',
'Pay attention to warnings - they often prevent runtime issues',
'Validate after any configuration changes'
],
pitfalls: [
'Empty config {} is valid for some nodes (e.g., manual trigger)',
'mode="minimal" only checks required fields, not value validity',
'Some warnings may be acceptable for specific use cases',
'Credential validation requires runtime context'
],
relatedTools: ['get_node', 'validate_workflow', 'n8n_autofix_workflow']
}
};