mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-21 18:03:07 +00:00
* feat: Remove 9 low-value tools and consolidate n8n_health_check (v2.25.0) Telemetry-driven tool cleanup to improve API clarity: **Removed Tools (9):** - list_nodes - Use search_nodes instead - list_ai_tools - Use search_nodes with isAITool filter - list_tasks - Low usage (0.02%) - get_database_statistics - Use n8n_health_check - list_templates - Use search_templates or get_templates_for_task - get_node_as_tool_info - Documented in get_node - validate_workflow_connections - Use validate_workflow - validate_workflow_expressions - Use validate_workflow - n8n_list_available_tools - Use n8n_health_check - n8n_diagnostic - Merged into n8n_health_check **Consolidated Tool:** - n8n_health_check now supports mode='diagnostic' for detailed troubleshooting **Tool Count:** - Before: 38 tools - After: 31 tools (18% reduction) Concieved by Romuald Członkowski - www.aiadvisors.pl/en 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: cleanup stale references and update tests after tool removal - Remove handleListAvailableTools dead code from handlers-n8n-manager.ts - Update error messages to reference n8n_health_check(mode="diagnostic") instead of n8n_diagnostic - Update tool counts in diagnostic messages (14 doc tools, 31 total) - Fix error-handling.test.ts to use valid tools (search_nodes, tools_documentation) - Remove obsolete list-tools.test.ts integration tests - Remove unused ListToolsResponse type from response-types.ts - Update tools.ts QUICK REFERENCE to remove list_nodes references - Update tools-documentation.ts to remove references to removed tools - Update tool-docs files to remove stale relatedTools references - Fix tools.test.ts to not test removed tools (list_nodes, list_ai_tools, etc.) - Fix parameter-validation.test.ts to not test removed tools - Update handlers-n8n-manager.test.ts error message expectations All 399 MCP unit tests now pass. 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: update integration tests to use valid tools after v2.25.0 removal Replaced all references to removed tools in integration tests: - list_nodes -> search_nodes - get_database_statistics -> tools_documentation - list_ai_tools -> search_nodes/tools_documentation - list_tasks -> tools_documentation - get_node_as_tool_info -> removed test section Updated test files: - tests/integration/mcp-protocol/basic-connection.test.ts - tests/integration/mcp-protocol/performance.test.ts - tests/integration/mcp-protocol/session-management.test.ts - tests/integration/mcp-protocol/test-helpers.ts - tests/integration/mcp-protocol/tool-invocation.test.ts - tests/integration/telemetry/mcp-telemetry.test.ts - tests/unit/mcp/disabled-tools.test.ts - tests/unit/mcp/tools-documentation.test.ts 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> * feat: Tool consolidation v2.26.0 - reduce tools by 38% (31 → 19) Major consolidation of MCP tools using mode-based parameters for better AI agent ergonomics: Node Tools: - get_node_documentation → get_node with mode='documentation' - search_node_properties → get_node with mode='search_properties' - get_property_dependencies → removed Validation Tools: - validate_node_operation + validate_node_minimal → validate_node with mode param Template Tools: - list_node_templates → search_templates with searchMode='nodes' - search_templates_by_metadata → search_templates with searchMode='metadata' - get_templates_for_task → search_templates with searchMode='task' Workflow Getters: - n8n_get_workflow_details/structure/minimal → n8n_get_workflow with mode param Execution Tools: - n8n_list/get/delete_execution → n8n_executions with action param Test updates for all consolidated tools. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en * docs: comprehensive README update for v2.26.0 tool consolidation - Quick Start: Added hosted service (dashboard.n8n-mcp.com) as primary option - Self-hosting: Renamed options to A (npx), B (Docker), C (Local), D (Railway) - Removed: "Memory Leak Fix (v2.20.2)" section (outdated) - Removed: "Known Issues" section (outdated container management) - Claude Project Setup: Updated all tool references to v2.26.0 consolidated tools - validate_node({mode: 'minimal'|'full'}) instead of separate tools - search_templates({searchMode: ...}) unified template search - get_node({mode: 'docs'|'search_properties'}) for documentation - n8n_executions({action: ...}) unified execution management - Available MCP Tools: Updated to show 19 consolidated tools (7 core + 12 mgmt) - Recent Updates: Simplified to just link to CHANGELOG.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en * fix: update tool count from 31 to 19 in diagnostic message 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(tests): update tool count expectations for v2.26.0 Update handlers-n8n-manager.test.ts to expect new consolidated tool counts (7/12/19) after v2.26.0 tool consolidation. 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>
431 lines
16 KiB
TypeScript
431 lines
16 KiB
TypeScript
import { ToolDefinition } from '../types';
|
|
|
|
/**
|
|
* n8n Documentation MCP Tools - FINAL OPTIMIZED VERSION
|
|
*
|
|
* Incorporates all lessons learned from real workflow building.
|
|
* Designed to help AI agents avoid common pitfalls and build workflows efficiently.
|
|
*/
|
|
export const n8nDocumentationToolsFinal: ToolDefinition[] = [
|
|
{
|
|
name: 'tools_documentation',
|
|
description: `Get documentation for n8n MCP tools. Call without parameters for quick start guide. Use topic parameter to get documentation for specific tools. Use depth='full' for comprehensive documentation.`,
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
topic: {
|
|
type: 'string',
|
|
description: 'Tool name (e.g., "search_nodes") or "overview" for general guide. Leave empty for quick reference.',
|
|
},
|
|
depth: {
|
|
type: 'string',
|
|
enum: ['essentials', 'full'],
|
|
description: 'Level of detail. "essentials" (default) for quick reference, "full" for comprehensive docs.',
|
|
default: 'essentials',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: 'search_nodes',
|
|
description: `Search n8n nodes by keyword with optional real-world examples. Pass query as string. Example: query="webhook" or query="database". Returns max 20 results. Use includeExamples=true to get top 2 template configs per node.`,
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
query: {
|
|
type: 'string',
|
|
description: 'Search terms. Use quotes for exact phrase.',
|
|
},
|
|
limit: {
|
|
type: 'number',
|
|
description: 'Max results (default 20)',
|
|
default: 20,
|
|
},
|
|
mode: {
|
|
type: 'string',
|
|
enum: ['OR', 'AND', 'FUZZY'],
|
|
description: 'OR=any word, AND=all words, FUZZY=typo-tolerant',
|
|
default: 'OR',
|
|
},
|
|
includeExamples: {
|
|
type: 'boolean',
|
|
description: 'Include top 2 real-world configuration examples from popular templates (default: false)',
|
|
default: false,
|
|
},
|
|
},
|
|
required: ['query'],
|
|
},
|
|
},
|
|
{
|
|
name: 'get_node',
|
|
description: `Get node info with progressive detail levels and multiple modes. Detail: minimal (~200 tokens), standard (~1-2K, default), full (~3-8K). Modes: info (default), docs (markdown documentation), search_properties (find properties), versions/compare/breaking/migrations (version info). Use format='docs' for readable documentation, mode='search_properties' with propertyQuery for finding specific fields.`,
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
nodeType: {
|
|
type: 'string',
|
|
description: 'Full node type: "nodes-base.httpRequest" or "nodes-langchain.agent"',
|
|
},
|
|
detail: {
|
|
type: 'string',
|
|
enum: ['minimal', 'standard', 'full'],
|
|
default: 'standard',
|
|
description: 'Information detail level. standard=essential properties (recommended), full=everything',
|
|
},
|
|
mode: {
|
|
type: 'string',
|
|
enum: ['info', 'docs', 'search_properties', 'versions', 'compare', 'breaking', 'migrations'],
|
|
default: 'info',
|
|
description: 'Operation mode. info=node schema, docs=readable markdown documentation, search_properties=find specific properties, versions/compare/breaking/migrations=version info',
|
|
},
|
|
includeTypeInfo: {
|
|
type: 'boolean',
|
|
default: false,
|
|
description: 'Include type structure metadata (type category, JS type, validation rules). Only applies to mode=info. Adds ~80-120 tokens per property.',
|
|
},
|
|
includeExamples: {
|
|
type: 'boolean',
|
|
default: false,
|
|
description: 'Include real-world configuration examples from templates. Only applies to mode=info with detail=standard. Adds ~200-400 tokens per example.',
|
|
},
|
|
fromVersion: {
|
|
type: 'string',
|
|
description: 'Source version for compare/breaking/migrations modes (e.g., "1.0")',
|
|
},
|
|
toVersion: {
|
|
type: 'string',
|
|
description: 'Target version for compare mode (e.g., "2.0"). Defaults to latest if omitted.',
|
|
},
|
|
propertyQuery: {
|
|
type: 'string',
|
|
description: 'For mode=search_properties: search term to find properties (e.g., "auth", "header", "body")',
|
|
},
|
|
maxPropertyResults: {
|
|
type: 'number',
|
|
description: 'For mode=search_properties: max results (default 20)',
|
|
default: 20,
|
|
},
|
|
},
|
|
required: ['nodeType'],
|
|
},
|
|
},
|
|
{
|
|
name: 'validate_node',
|
|
description: `Validate n8n node configuration. Use mode='full' for comprehensive validation with errors/warnings/suggestions, mode='minimal' for quick required fields check. Example: nodeType="nodes-base.slack", config={resource:"channel",operation:"create"}`,
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
nodeType: {
|
|
type: 'string',
|
|
description: 'Node type as string. Example: "nodes-base.slack"',
|
|
},
|
|
config: {
|
|
type: 'object',
|
|
description: 'Configuration as object. For simple nodes use {}. For complex nodes include fields like {resource:"channel",operation:"create"}',
|
|
},
|
|
mode: {
|
|
type: 'string',
|
|
enum: ['full', 'minimal'],
|
|
description: 'Validation mode. full=comprehensive validation with errors/warnings/suggestions, minimal=quick required fields check only. Default is "full"',
|
|
default: 'full',
|
|
},
|
|
profile: {
|
|
type: 'string',
|
|
enum: ['strict', 'runtime', 'ai-friendly', 'minimal'],
|
|
description: 'Profile for mode=full: "minimal", "runtime", "ai-friendly", or "strict". Default is "ai-friendly"',
|
|
default: 'ai-friendly',
|
|
},
|
|
},
|
|
required: ['nodeType', 'config'],
|
|
additionalProperties: false,
|
|
},
|
|
outputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
nodeType: { type: 'string' },
|
|
workflowNodeType: { type: 'string' },
|
|
displayName: { type: 'string' },
|
|
valid: { type: 'boolean' },
|
|
errors: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
type: { type: 'string' },
|
|
property: { type: 'string' },
|
|
message: { type: 'string' },
|
|
fix: { type: 'string' }
|
|
}
|
|
}
|
|
},
|
|
warnings: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
type: { type: 'string' },
|
|
property: { type: 'string' },
|
|
message: { type: 'string' },
|
|
suggestion: { type: 'string' }
|
|
}
|
|
}
|
|
},
|
|
suggestions: { type: 'array', items: { type: 'string' } },
|
|
missingRequiredFields: {
|
|
type: 'array',
|
|
items: { type: 'string' },
|
|
description: 'Only present in mode=minimal'
|
|
},
|
|
summary: {
|
|
type: 'object',
|
|
properties: {
|
|
hasErrors: { type: 'boolean' },
|
|
errorCount: { type: 'number' },
|
|
warningCount: { type: 'number' },
|
|
suggestionCount: { type: 'number' }
|
|
}
|
|
}
|
|
},
|
|
required: ['nodeType', 'displayName', 'valid']
|
|
},
|
|
},
|
|
{
|
|
name: 'get_template',
|
|
description: `Get template by ID. Use mode to control response size: nodes_only (minimal), structure (nodes+connections), full (complete workflow).`,
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
templateId: {
|
|
type: 'number',
|
|
description: 'The template ID to retrieve',
|
|
},
|
|
mode: {
|
|
type: 'string',
|
|
enum: ['nodes_only', 'structure', 'full'],
|
|
description: 'Response detail level. nodes_only: just node list, structure: nodes+connections, full: complete workflow JSON.',
|
|
default: 'full',
|
|
},
|
|
},
|
|
required: ['templateId'],
|
|
},
|
|
},
|
|
{
|
|
name: 'search_templates',
|
|
description: `Search templates with multiple modes. Use searchMode='keyword' for text search, 'by_nodes' to find templates using specific nodes, 'by_task' for curated task-based templates, 'by_metadata' for filtering by complexity/setup time/services.`,
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
searchMode: {
|
|
type: 'string',
|
|
enum: ['keyword', 'by_nodes', 'by_task', 'by_metadata'],
|
|
description: 'Search mode. keyword=text search (default), by_nodes=find by node types, by_task=curated task templates, by_metadata=filter by complexity/services',
|
|
default: 'keyword',
|
|
},
|
|
// For searchMode='keyword'
|
|
query: {
|
|
type: 'string',
|
|
description: 'For searchMode=keyword: search keyword (e.g., "chatbot")',
|
|
},
|
|
fields: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'string',
|
|
enum: ['id', 'name', 'description', 'author', 'nodes', 'views', 'created', 'url', 'metadata'],
|
|
},
|
|
description: 'For searchMode=keyword: fields to include in response. Default: all fields.',
|
|
},
|
|
// For searchMode='by_nodes'
|
|
nodeTypes: {
|
|
type: 'array',
|
|
items: { type: 'string' },
|
|
description: 'For searchMode=by_nodes: array of node types (e.g., ["n8n-nodes-base.httpRequest", "n8n-nodes-base.slack"])',
|
|
},
|
|
// For searchMode='by_task'
|
|
task: {
|
|
type: 'string',
|
|
enum: [
|
|
'ai_automation',
|
|
'data_sync',
|
|
'webhook_processing',
|
|
'email_automation',
|
|
'slack_integration',
|
|
'data_transformation',
|
|
'file_processing',
|
|
'scheduling',
|
|
'api_integration',
|
|
'database_operations'
|
|
],
|
|
description: 'For searchMode=by_task: the type of task',
|
|
},
|
|
// For searchMode='by_metadata'
|
|
category: {
|
|
type: 'string',
|
|
description: 'For searchMode=by_metadata: filter by category (e.g., "automation", "integration")',
|
|
},
|
|
complexity: {
|
|
type: 'string',
|
|
enum: ['simple', 'medium', 'complex'],
|
|
description: 'For searchMode=by_metadata: filter by complexity level',
|
|
},
|
|
maxSetupMinutes: {
|
|
type: 'number',
|
|
description: 'For searchMode=by_metadata: maximum setup time in minutes',
|
|
minimum: 5,
|
|
maximum: 480,
|
|
},
|
|
minSetupMinutes: {
|
|
type: 'number',
|
|
description: 'For searchMode=by_metadata: minimum setup time in minutes',
|
|
minimum: 5,
|
|
maximum: 480,
|
|
},
|
|
requiredService: {
|
|
type: 'string',
|
|
description: 'For searchMode=by_metadata: filter by required service (e.g., "openai", "slack")',
|
|
},
|
|
targetAudience: {
|
|
type: 'string',
|
|
description: 'For searchMode=by_metadata: filter by target audience (e.g., "developers", "marketers")',
|
|
},
|
|
// Common pagination
|
|
limit: {
|
|
type: 'number',
|
|
description: 'Maximum number of results. Default 20.',
|
|
default: 20,
|
|
minimum: 1,
|
|
maximum: 100,
|
|
},
|
|
offset: {
|
|
type: 'number',
|
|
description: 'Pagination offset. Default 0.',
|
|
default: 0,
|
|
minimum: 0,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: 'validate_workflow',
|
|
description: `Full workflow validation: structure, connections, expressions, AI tools. Returns errors/warnings/fixes. Essential before deploy.`,
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
workflow: {
|
|
type: 'object',
|
|
description: 'The complete workflow JSON to validate. Must include nodes array and connections object.',
|
|
},
|
|
options: {
|
|
type: 'object',
|
|
properties: {
|
|
validateNodes: {
|
|
type: 'boolean',
|
|
description: 'Validate individual node configurations. Default true.',
|
|
default: true,
|
|
},
|
|
validateConnections: {
|
|
type: 'boolean',
|
|
description: 'Validate node connections and flow. Default true.',
|
|
default: true,
|
|
},
|
|
validateExpressions: {
|
|
type: 'boolean',
|
|
description: 'Validate n8n expressions syntax and references. Default true.',
|
|
default: true,
|
|
},
|
|
profile: {
|
|
type: 'string',
|
|
enum: ['minimal', 'runtime', 'ai-friendly', 'strict'],
|
|
description: 'Validation profile for node validation. Default "runtime".',
|
|
default: 'runtime',
|
|
},
|
|
},
|
|
description: 'Optional validation settings',
|
|
},
|
|
},
|
|
required: ['workflow'],
|
|
additionalProperties: false,
|
|
},
|
|
outputSchema: {
|
|
type: 'object',
|
|
properties: {
|
|
valid: { type: 'boolean' },
|
|
summary: {
|
|
type: 'object',
|
|
properties: {
|
|
totalNodes: { type: 'number' },
|
|
enabledNodes: { type: 'number' },
|
|
triggerNodes: { type: 'number' },
|
|
validConnections: { type: 'number' },
|
|
invalidConnections: { type: 'number' },
|
|
expressionsValidated: { type: 'number' },
|
|
errorCount: { type: 'number' },
|
|
warningCount: { type: 'number' }
|
|
}
|
|
},
|
|
errors: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
node: { type: 'string' },
|
|
message: { type: 'string' },
|
|
details: { type: 'string' }
|
|
}
|
|
}
|
|
},
|
|
warnings: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
node: { type: 'string' },
|
|
message: { type: 'string' },
|
|
details: { type: 'string' }
|
|
}
|
|
}
|
|
},
|
|
suggestions: { type: 'array', items: { type: 'string' } }
|
|
},
|
|
required: ['valid', 'summary']
|
|
},
|
|
},
|
|
];
|
|
|
|
/**
|
|
* QUICK REFERENCE for AI Agents:
|
|
*
|
|
* 1. RECOMMENDED WORKFLOW:
|
|
* - Start: search_nodes → get_node → validate_node
|
|
* - Discovery: search_nodes({query:"trigger"}) for finding nodes
|
|
* - Quick Config: get_node("nodes-base.httpRequest", {detail:"standard"}) - only essential properties
|
|
* - Documentation: get_node("nodes-base.httpRequest", {mode:"docs"}) - readable markdown docs
|
|
* - Find Properties: get_node("nodes-base.httpRequest", {mode:"search_properties", propertyQuery:"auth"})
|
|
* - Full Details: get_node with detail="full" only when standard isn't enough
|
|
* - Validation: Use validate_node for complex nodes (Slack, Google Sheets, etc.)
|
|
*
|
|
* 2. COMMON NODE TYPES:
|
|
* Triggers: webhook, schedule, emailReadImap, slackTrigger
|
|
* Core: httpRequest, code, set, if, merge, splitInBatches
|
|
* Integrations: slack, gmail, googleSheets, postgres, mongodb
|
|
* AI: agent, openAi, chainLlm, documentLoader
|
|
*
|
|
* 3. SEARCH TIPS:
|
|
* - search_nodes returns ANY word match (OR logic)
|
|
* - Single words more precise, multiple words broader
|
|
* - If no results: try different keywords or partial names
|
|
*
|
|
* 4. TEMPLATE SEARCHING:
|
|
* - search_templates("slack") searches template names/descriptions, NOT node types!
|
|
* - To find templates using Slack node: search_templates({searchMode:"by_nodes", nodeTypes:["n8n-nodes-base.slack"]})
|
|
* - For task-based templates: search_templates({searchMode:"by_task", task:"slack_integration"})
|
|
*
|
|
* 5. KNOWN ISSUES:
|
|
* - Some nodes have duplicate properties with different conditions
|
|
* - Package names: use 'n8n-nodes-base' not '@n8n/n8n-nodes-base'
|
|
* - Check showWhen/hideWhen to identify the right property variant
|
|
*
|
|
* 6. PERFORMANCE:
|
|
* - get_node (detail=standard): Fast (<5KB)
|
|
* - get_node (detail=full): Slow (100KB+) - use sparingly
|
|
* - search_nodes: Fast, cached
|
|
*/ |