feat(tools): rename start_here to tools_documentation with depth control (v2.7.4)
- Renamed start_here_workflow_guide to tools_documentation for clarity - Added depth parameter to control documentation detail (essentials/full) - Converted output from JSON to LLM-friendly plain text format - Added per-tool documentation capability - Created two-tier documentation system: - Essentials: brief info with key parameters and tips - Full: comprehensive docs with examples and best practices - Documented 8 commonly used MCP tools - Removed 380+ lines of unused getWorkflowGuide method - Fixed duplicate tool definitions - Updated all documentation references - Added test script for tools documentation BREAKING CHANGE: start_here_workflow_guide renamed to tools_documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import { WorkflowValidator } from '../services/workflow-validator';
|
||||
import { isN8nApiConfigured } from '../config/n8n-api';
|
||||
import * as n8nHandlers from './handlers-n8n-manager';
|
||||
import { handleUpdatePartialWorkflow } from './handlers-workflow-diff';
|
||||
import { getToolDocumentation, getToolsOverview } from './tools-documentation';
|
||||
import { PROJECT_VERSION } from '../utils/version';
|
||||
|
||||
interface NodeRow {
|
||||
@@ -191,8 +192,8 @@ export class N8NDocumentationMCPServer {
|
||||
|
||||
async executeTool(name: string, args: any): Promise<any> {
|
||||
switch (name) {
|
||||
case 'start_here_workflow_guide':
|
||||
return this.getWorkflowGuide(args.topic);
|
||||
case 'tools_documentation':
|
||||
return this.getToolsDocumentation(args.topic, args.depth);
|
||||
case 'list_nodes':
|
||||
return this.listNodes(args);
|
||||
case 'get_node_info':
|
||||
@@ -1180,385 +1181,14 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
|
||||
};
|
||||
}
|
||||
|
||||
private async getWorkflowGuide(topic?: string): Promise<any> {
|
||||
const guides: Record<string, any> = {
|
||||
overview: {
|
||||
title: "n8n MCP Tools Quick Start Guide",
|
||||
sections: {
|
||||
recommended_workflow: {
|
||||
title: "Recommended Workflow",
|
||||
steps: [
|
||||
"1. search_nodes({query:'slack'}) - Find nodes by keyword",
|
||||
"2. get_node_essentials('nodes-base.slack') - Get only essential properties (<5KB)",
|
||||
"3. get_node_for_task('send_slack_message') - Get pre-configured settings",
|
||||
"4. validate_node_minimal() - Quick check for required fields only",
|
||||
"5. validate_node_operation() - Full validation with suggestions"
|
||||
],
|
||||
tip: "Avoid get_node_info unless you need ALL properties (100KB+ response)"
|
||||
},
|
||||
essential_tools: {
|
||||
discovery: "list_nodes({category:'trigger'}) - Browse by category",
|
||||
quick_config: "get_node_essentials() - 95% smaller than get_node_info",
|
||||
tasks: "list_tasks() then get_node_for_task() - Pre-configured common tasks",
|
||||
validation: "validate_node_minimal() for quick checks, validate_node_operation() for full validation",
|
||||
ai_tools: "get_node_as_tool_info() - Learn how to use ANY node as an AI tool",
|
||||
management: "n8n_create_workflow, n8n_list_workflows - Manage workflows (if API configured)"
|
||||
},
|
||||
ai_workflow_pattern: {
|
||||
title: "AI Agent Workflows",
|
||||
key_insight: "ANY node can be used as an AI tool - not just those marked with usableAsTool!",
|
||||
steps: [
|
||||
"1. Create an AI Agent node (e.g., @n8n/n8n-nodes-langchain.agent)",
|
||||
"2. Connect ANY node to the AI Agent's 'ai_tool' port",
|
||||
"3. Use get_node_as_tool_info() to understand tool configuration",
|
||||
"4. Configure tool with $fromAI() expressions for dynamic values",
|
||||
"5. validate_workflow() to check AI tool connections"
|
||||
],
|
||||
examples: [
|
||||
"Slack node → AI Agent's tool port = AI can send Slack messages",
|
||||
"Google Sheets → AI Agent's tool port = AI can read/write spreadsheets",
|
||||
"HTTP Request → AI Agent's tool port = AI can call any API"
|
||||
],
|
||||
validation: "Use validate_workflow() to verify ai_tool connections are valid"
|
||||
},
|
||||
complete_workflow_lifecycle: {
|
||||
title: "Complete Workflow Lifecycle (NEW!)",
|
||||
overview: "With n8n management tools, you can now manage the entire workflow lifecycle:",
|
||||
phases: {
|
||||
"1. Discover": {
|
||||
tools: ["search_nodes", "list_nodes", "get_node_documentation"],
|
||||
purpose: "Find the right nodes for your automation"
|
||||
},
|
||||
"2. Build": {
|
||||
tools: ["get_node_essentials", "get_node_for_task", "search_node_properties"],
|
||||
purpose: "Configure nodes with the right settings"
|
||||
},
|
||||
"3. Validate": {
|
||||
tools: ["validate_node_minimal", "validate_node_operation", "validate_workflow", "n8n_validate_workflow"],
|
||||
purpose: "Ensure your workflow is correct before deployment",
|
||||
new: "n8n_validate_workflow - Validate workflows already in n8n by ID"
|
||||
},
|
||||
"4. Deploy": {
|
||||
tools: ["n8n_create_workflow", "n8n_update_workflow", "n8n_list_workflows"],
|
||||
purpose: "Create or update workflows in your n8n instance",
|
||||
requirement: "Requires N8N_API_URL and N8N_API_KEY configuration"
|
||||
},
|
||||
"5. Execute": {
|
||||
tools: ["n8n_trigger_webhook_workflow", "n8n_list_executions", "n8n_get_execution"],
|
||||
purpose: "Run workflows and monitor their execution",
|
||||
note: "Workflows must be activated manually in n8n UI"
|
||||
}
|
||||
},
|
||||
example_flow: [
|
||||
"1. search_nodes({query: 'slack'}) - Find Slack node",
|
||||
"2. get_node_essentials('nodes-base.slack') - Get configuration",
|
||||
"3. validate_node_operation() - Validate settings",
|
||||
"4. n8n_create_workflow() - Deploy to n8n",
|
||||
"5. n8n_validate_workflow({id: 'workflow-id'}) - Validate deployed workflow",
|
||||
"6. n8n_trigger_webhook_workflow() - Execute via webhook"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
workflow: {
|
||||
title: "Efficient Workflow Patterns",
|
||||
patterns: [
|
||||
{
|
||||
name: "Building from scratch",
|
||||
steps: [
|
||||
"search_nodes or list_nodes to find nodes",
|
||||
"get_node_essentials for configuration",
|
||||
"validate_node_minimal for quick required field check",
|
||||
"validate_node_operation for full validation"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Common tasks",
|
||||
steps: [
|
||||
"list_tasks() to see available templates",
|
||||
"get_node_for_task() for instant configuration",
|
||||
"Fill in userMustProvide fields",
|
||||
"validate_node_minimal() to ensure all required fields present"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "AI Agent with Tools",
|
||||
steps: [
|
||||
"Create AI Agent node",
|
||||
"search_nodes() to find tool nodes",
|
||||
"get_node_as_tool_info() for each tool node",
|
||||
"Connect nodes to ai_tool port",
|
||||
"Configure with $fromAI() expressions",
|
||||
"validate_workflow() to check everything"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
search_tips: {
|
||||
title: "Search Best Practices",
|
||||
tips: [
|
||||
"search_nodes returns ANY word match (OR logic)",
|
||||
"'send slack message' finds nodes with 'send' OR 'slack' OR 'message'",
|
||||
"Single words are more precise: 'slack' vs 'slack message'",
|
||||
"Use list_nodes({category:'trigger'}) if search fails",
|
||||
"Node types need prefix: 'nodes-base.slack' not just 'slack'"
|
||||
]
|
||||
},
|
||||
common_nodes: {
|
||||
title: "Most Used Nodes",
|
||||
categories: {
|
||||
triggers: ["webhook", "schedule", "emailReadImap", "slackTrigger"],
|
||||
core: ["httpRequest", "code", "set", "if", "merge", "splitInBatches"],
|
||||
integrations: ["slack", "gmail", "googleSheets", "postgres", "mongodb"],
|
||||
ai: ["agent", "openAi", "chainLlm", "documentLoader"]
|
||||
},
|
||||
ai_tool_usage: {
|
||||
note: "ANY node from above can be used as an AI tool!",
|
||||
popular_ai_tools: [
|
||||
"slack - Send messages, create channels",
|
||||
"googleSheets - Read/write data",
|
||||
"httpRequest - Call any API",
|
||||
"gmail - Send emails",
|
||||
"postgres - Query databases"
|
||||
]
|
||||
}
|
||||
},
|
||||
known_issues: {
|
||||
title: "Known Issues & Workarounds",
|
||||
issues: [
|
||||
"Package names: Use 'n8n-nodes-base' NOT '@n8n/n8n-nodes-base'",
|
||||
"Duplicate properties: Check showWhen/hideWhen conditions",
|
||||
"Large responses: Use get_node_essentials instead of get_node_info",
|
||||
"Property search: Some nodes have 200+ properties, use search_node_properties",
|
||||
"Node not found: Try without prefix or lowercase"
|
||||
]
|
||||
},
|
||||
performance: {
|
||||
title: "Performance Guide",
|
||||
tools: {
|
||||
fast: [
|
||||
"get_node_essentials - <5KB responses",
|
||||
"search_nodes - Indexed search",
|
||||
"list_nodes - Direct queries",
|
||||
"validate_node_minimal - Only required fields",
|
||||
"start_here_workflow_guide - Static content"
|
||||
],
|
||||
slow: [
|
||||
"get_node_info - 100KB+ responses",
|
||||
"get_node_documentation - Can be large",
|
||||
"validate_workflow - Full workflow analysis"
|
||||
]
|
||||
},
|
||||
tips: [
|
||||
"Use get_node_essentials for 95% of use cases",
|
||||
"Only use get_node_info when essentials lack needed property",
|
||||
"Results are cached for repeated queries",
|
||||
"Use validate_node_minimal before validate_node_operation"
|
||||
]
|
||||
},
|
||||
ai_tools: {
|
||||
title: "AI Tools & Agent Workflows",
|
||||
key_concept: "In n8n, ANY node can be used as an AI tool - not just those marked with usableAsTool!",
|
||||
how_it_works: {
|
||||
"1. Connection": "Connect any node to an AI Agent's 'ai_tool' port",
|
||||
"2. Configuration": "Use $fromAI() expressions to let AI provide dynamic values",
|
||||
"3. Description": "Give tools clear names and descriptions in AI Agent settings",
|
||||
"4. Validation": "Use validate_workflow() to verify ai_tool connections"
|
||||
},
|
||||
common_patterns: {
|
||||
"Data Collection": {
|
||||
nodes: ["googleSheets", "postgres", "mongodb"],
|
||||
usage: "AI reads data to answer questions or make decisions"
|
||||
},
|
||||
"Actions & Notifications": {
|
||||
nodes: ["slack", "gmail", "httpRequest"],
|
||||
usage: "AI performs actions based on analysis"
|
||||
},
|
||||
"API Integration": {
|
||||
nodes: ["httpRequest", "webhook"],
|
||||
usage: "AI calls external services and APIs"
|
||||
}
|
||||
},
|
||||
example_expressions: {
|
||||
"Dynamic values": '{{ $fromAI("channel", "Slack channel to post to") }}',
|
||||
"Complex data": '{{ $fromAI("query", "SQL query to execute") }}',
|
||||
"Conditional": '{{ $fromAI("shouldNotify", "true/false to send notification") }}'
|
||||
},
|
||||
best_practices: [
|
||||
"Test nodes individually before connecting as tools",
|
||||
"Write detailed tool descriptions for better AI understanding",
|
||||
"Use validate_workflow() to catch connection issues",
|
||||
"Start simple - one or two tools, then expand",
|
||||
"Monitor AI tool usage in workflow executions"
|
||||
],
|
||||
tools_to_use: [
|
||||
"get_node_as_tool_info() - Understand any node's AI capabilities",
|
||||
"list_ai_tools() - See nodes optimized for AI (263 available)",
|
||||
"validate_workflow() - Verify ai_tool connections",
|
||||
"get_node_essentials() - Configure tool nodes efficiently"
|
||||
]
|
||||
},
|
||||
n8n_management: {
|
||||
title: "n8n Workflow Management Tools (NEW!)",
|
||||
overview: "Manage n8n workflows directly through MCP. Create, update, execute, and monitor workflows programmatically.",
|
||||
requirements: {
|
||||
configuration: "Set N8N_API_URL and N8N_API_KEY environment variables",
|
||||
access: "n8n instance with API access enabled",
|
||||
version: "n8n v1.0.0 or higher"
|
||||
},
|
||||
available_tools: {
|
||||
workflow_management: [
|
||||
"n8n_create_workflow - Create new workflows with nodes and connections",
|
||||
"n8n_get_workflow - Get complete workflow by ID",
|
||||
"n8n_get_workflow_details - Get workflow with execution statistics",
|
||||
"n8n_update_workflow - Update existing workflows (requires full node array)",
|
||||
"n8n_delete_workflow - Delete workflows permanently",
|
||||
"n8n_list_workflows - List workflows with filtering"
|
||||
],
|
||||
execution_management: [
|
||||
"n8n_trigger_webhook_workflow - Execute workflows via webhook",
|
||||
"n8n_get_execution - Get execution details",
|
||||
"n8n_list_executions - List executions with status filtering",
|
||||
"n8n_delete_execution - Delete execution records"
|
||||
],
|
||||
system_tools: [
|
||||
"n8n_health_check - Check API connectivity",
|
||||
"n8n_list_available_tools - List all management tools"
|
||||
]
|
||||
},
|
||||
limitations: {
|
||||
"Workflow Activation": "Cannot activate/deactivate workflows via API - use n8n UI",
|
||||
"Direct Execution": "No direct execution - must use webhook triggers",
|
||||
"Update Requirements": "Updates require complete nodes array, not just changes",
|
||||
"Tags": "Read-only during creation/update"
|
||||
},
|
||||
workflow_examples: {
|
||||
"⚠️ CRITICAL: Connection Rules": {
|
||||
warning: "ALWAYS use node NAMES in connections, NEVER use node IDs!",
|
||||
explanation: "Using IDs will make nodes appear disconnected in n8n UI",
|
||||
wrong: {
|
||||
connections: {"1": {main: [[{node: "2", type: "main", index: 0}]]}} // ❌ WRONG - uses IDs
|
||||
},
|
||||
correct: {
|
||||
connections: {"Start": {main: [[{node: "Set", type: "main", index: 0}]]}} // ✅ CORRECT - uses names
|
||||
}
|
||||
},
|
||||
"Create Simple Workflow": {
|
||||
tools: ["n8n_create_workflow"],
|
||||
example: {
|
||||
name: "My Test Workflow",
|
||||
nodes: [
|
||||
{id: "1", name: "Start", type: "n8n-nodes-base.start", position: [250, 300]},
|
||||
{id: "2", name: "Set", type: "n8n-nodes-base.set", position: [450, 300]}
|
||||
],
|
||||
connections: {"Start": {main: [[{node: "Set", type: "main", index: 0}]]}} // ✅ Uses node names!
|
||||
}
|
||||
},
|
||||
"Execute via Webhook": {
|
||||
tools: ["n8n_trigger_webhook_workflow"],
|
||||
steps: [
|
||||
"1. Workflow must have webhook trigger node",
|
||||
"2. Workflow must be manually activated in UI",
|
||||
"3. Use webhook URL from workflow"
|
||||
]
|
||||
}
|
||||
},
|
||||
best_practices: [
|
||||
"⚠️ ALWAYS use node NAMES in connections, NEVER node IDs",
|
||||
"Always use n8n_health_check first to verify connectivity",
|
||||
"Fetch full workflow before updating (n8n_get_workflow)",
|
||||
"Validate workflows before creating (validate_workflow)",
|
||||
"Monitor executions after triggering webhooks",
|
||||
"Use descriptive workflow names for easy management"
|
||||
],
|
||||
integration_pattern: {
|
||||
title: "Complete Automation Pipeline",
|
||||
steps: [
|
||||
"1. Design: Use documentation tools to understand nodes",
|
||||
"2. Build: Configure nodes with get_node_essentials",
|
||||
"3. Validate: Use validate_workflow before deployment",
|
||||
"4. Deploy: Create with n8n_create_workflow",
|
||||
"5. Activate: Manually activate in n8n UI",
|
||||
"6. Execute: Trigger with n8n_trigger_webhook_workflow",
|
||||
"7. Monitor: Check status with n8n_list_executions"
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
// Method removed - replaced by getToolsDocumentation
|
||||
|
||||
if (topic && guides[topic]) {
|
||||
return guides[topic];
|
||||
private async getToolsDocumentation(topic?: string, depth: 'essentials' | 'full' = 'essentials'): Promise<string> {
|
||||
if (!topic || topic === 'overview') {
|
||||
return getToolsOverview(depth);
|
||||
}
|
||||
|
||||
// Return complete overview
|
||||
return {
|
||||
title: "n8n MCP Tools Complete Guide",
|
||||
quickStart: guides.overview,
|
||||
sections: {
|
||||
workflow: guides.workflow,
|
||||
searchTips: guides.search_tips,
|
||||
commonNodes: guides.common_nodes,
|
||||
knownIssues: guides.known_issues,
|
||||
performance: guides.performance,
|
||||
aiTools: guides.ai_tools,
|
||||
n8nManagement: guides.n8n_management
|
||||
},
|
||||
examples: {
|
||||
"Find and configure Slack": [
|
||||
"search_nodes({query:'slack'})",
|
||||
"get_node_essentials('nodes-base.slack')",
|
||||
"validate_node_minimal('nodes-base.slack', {resource:'message',operation:'post'})",
|
||||
"get_node_for_task('send_slack_message')"
|
||||
],
|
||||
"Set up webhook trigger": [
|
||||
"get_node_for_task('receive_webhook')",
|
||||
"validate_node_minimal('nodes-base.webhook', config)",
|
||||
"// Returns pre-configured webhook with instructions"
|
||||
],
|
||||
"HTTP API call": [
|
||||
"get_node_essentials('nodes-base.httpRequest')",
|
||||
"search_node_properties('nodes-base.httpRequest', 'auth')",
|
||||
"validate_node_operation('nodes-base.httpRequest', config)"
|
||||
],
|
||||
"AI Agent with Slack tool": [
|
||||
"search_nodes({query:'agent'})",
|
||||
"get_node_as_tool_info('nodes-base.slack')",
|
||||
"// Connect Slack to AI Agent's ai_tool port",
|
||||
"// Configure with $fromAI() expressions",
|
||||
"validate_workflow(workflow)"
|
||||
],
|
||||
"Complete Workflow Lifecycle": [
|
||||
"// 1. Discover & Design",
|
||||
"search_nodes({query: 'webhook'})",
|
||||
"get_node_essentials('nodes-base.webhook')",
|
||||
"// 2. Build & Validate",
|
||||
"const workflow = { nodes: [...], connections: {...} }",
|
||||
"validate_workflow(workflow)",
|
||||
"// 3. Deploy (requires API config)",
|
||||
"n8n_create_workflow(workflow)",
|
||||
"// 4. Execute",
|
||||
"n8n_trigger_webhook_workflow({webhookUrl: '...'})",
|
||||
"// 5. Monitor",
|
||||
"n8n_list_executions({workflowId: '...'})"
|
||||
]
|
||||
},
|
||||
validation_guide: {
|
||||
title: "Validation Tools Guide",
|
||||
tools: {
|
||||
"validate_node_minimal": "Fastest - only checks required fields",
|
||||
"validate_node_operation": "Smart - checks based on selected operation",
|
||||
"validate_workflow": "Complete - validates entire workflow including AI connections",
|
||||
"validate_workflow_connections": "Structure - just checks node connections",
|
||||
"validate_workflow_expressions": "Expressions - validates $json, $node, $fromAI"
|
||||
},
|
||||
when_to_use: {
|
||||
"Building nodes": "Use validate_node_minimal first, then validate_node_operation",
|
||||
"AI workflows": "Always use validate_workflow to check ai_tool connections",
|
||||
"Quick checks": "validate_node_minimal when you just need required fields",
|
||||
"Before deployment": "validate_workflow with all options enabled"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return getToolDocumentation(topic, depth);
|
||||
}
|
||||
|
||||
// Add connect method to accept any transport
|
||||
|
||||
644
src/mcp/tools-documentation.ts
Normal file
644
src/mcp/tools-documentation.ts
Normal file
@@ -0,0 +1,644 @@
|
||||
interface ToolDocumentation {
|
||||
name: string;
|
||||
category: string;
|
||||
essentials: {
|
||||
description: string;
|
||||
keyParameters: string[];
|
||||
example: string;
|
||||
performance: string;
|
||||
tips: string[];
|
||||
};
|
||||
full: {
|
||||
description: string;
|
||||
parameters: Record<string, { type: string; description: string; required?: boolean }>;
|
||||
returns: string;
|
||||
examples: string[];
|
||||
useCases: string[];
|
||||
performance: string;
|
||||
bestPractices: string[];
|
||||
pitfalls: string[];
|
||||
relatedTools: string[];
|
||||
};
|
||||
}
|
||||
|
||||
export const toolsDocumentation: Record<string, ToolDocumentation> = {
|
||||
search_nodes: {
|
||||
name: 'search_nodes',
|
||||
category: 'discovery',
|
||||
essentials: {
|
||||
description: 'Search for n8n nodes by keyword across names, descriptions, and categories',
|
||||
keyParameters: ['query', 'limit'],
|
||||
example: 'search_nodes({query: "slack", limit: 10})',
|
||||
performance: 'Fast - uses indexed full-text search',
|
||||
tips: [
|
||||
'Uses OR logic - "send slack" finds nodes with ANY of these words',
|
||||
'Single words are more precise than phrases'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Performs full-text search across all n8n nodes using indexed search. Returns nodes matching ANY word in the query (OR logic). Searches through node names, display names, descriptions, and categories.',
|
||||
parameters: {
|
||||
query: { type: 'string', description: 'Search terms (words are ORed together)', required: true },
|
||||
limit: { type: 'number', description: 'Maximum results to return (default: 20)', required: false }
|
||||
},
|
||||
returns: 'Array of nodes with nodeType, displayName, description, category, and relevance score',
|
||||
examples: [
|
||||
'search_nodes({query: "slack"}) - Find all Slack-related nodes',
|
||||
'search_nodes({query: "webhook trigger", limit: 5}) - Find nodes with "webhook" OR "trigger"',
|
||||
'search_nodes({query: "ai"}) - Find AI-related nodes'
|
||||
],
|
||||
useCases: [
|
||||
'Finding nodes for specific integrations',
|
||||
'Discovering available functionality',
|
||||
'Exploring nodes by keyword when exact name unknown'
|
||||
],
|
||||
performance: 'Very fast - uses SQLite FTS5 full-text index. Typically <50ms even for complex queries.',
|
||||
bestPractices: [
|
||||
'Use single words for precise matches',
|
||||
'Try different variations if first search fails',
|
||||
'Use list_nodes for browsing by category',
|
||||
'Remember it\'s OR logic, not AND'
|
||||
],
|
||||
pitfalls: [
|
||||
'Multi-word queries may return too many results',
|
||||
'Doesn\'t search in node properties or operations',
|
||||
'Case-insensitive but doesn\'t handle typos'
|
||||
],
|
||||
relatedTools: ['list_nodes', 'get_node_essentials', 'get_node_info']
|
||||
}
|
||||
},
|
||||
|
||||
get_node_essentials: {
|
||||
name: 'get_node_essentials',
|
||||
category: 'configuration',
|
||||
essentials: {
|
||||
description: 'Get only the most important 10-20 properties for a node with examples',
|
||||
keyParameters: ['nodeType'],
|
||||
example: 'get_node_essentials("n8n-nodes-base.slack")',
|
||||
performance: 'Very fast - returns <5KB instead of 100KB+',
|
||||
tips: [
|
||||
'Use this instead of get_node_info for 95% of cases',
|
||||
'Includes working examples for common operations'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Returns a curated set of essential properties for a node, typically 10-20 most commonly used properties. Includes working examples and is 95% smaller than get_node_info. Designed for efficient node configuration.',
|
||||
parameters: {
|
||||
nodeType: { type: 'string', description: 'Full node type (e.g., "n8n-nodes-base.slack")', required: true }
|
||||
},
|
||||
returns: 'Object with node info, essential properties, examples, and common patterns',
|
||||
examples: [
|
||||
'get_node_essentials("n8n-nodes-base.httpRequest") - Get HTTP request essentials',
|
||||
'get_node_essentials("n8n-nodes-base.webhook") - Get webhook configuration',
|
||||
'get_node_essentials("n8n-nodes-base.slack") - Get Slack essentials'
|
||||
],
|
||||
useCases: [
|
||||
'Quickly configuring nodes without information overload',
|
||||
'Getting working examples for immediate use',
|
||||
'Understanding the most important node options',
|
||||
'Building workflows efficiently'
|
||||
],
|
||||
performance: 'Extremely fast - returns pre-filtered data. Response size <5KB vs 100KB+ for full node info.',
|
||||
bestPractices: [
|
||||
'Always try this before get_node_info',
|
||||
'Use included examples as starting points',
|
||||
'Check commonPatterns for typical configurations',
|
||||
'Combine with validate_node_minimal for quick validation'
|
||||
],
|
||||
pitfalls: [
|
||||
'May not include rarely-used properties',
|
||||
'Some advanced options might be missing',
|
||||
'Use search_node_properties if specific property not found'
|
||||
],
|
||||
relatedTools: ['get_node_info', 'search_node_properties', 'validate_node_minimal']
|
||||
}
|
||||
},
|
||||
|
||||
list_nodes: {
|
||||
name: 'list_nodes',
|
||||
category: 'discovery',
|
||||
essentials: {
|
||||
description: 'List all available n8n nodes with optional filtering',
|
||||
keyParameters: ['category', 'limit', 'onlyTriggers'],
|
||||
example: 'list_nodes({category: "communication", limit: 20})',
|
||||
performance: 'Fast - direct database query',
|
||||
tips: [
|
||||
'Great for browsing nodes by category',
|
||||
'Use onlyTriggers:true to find workflow starters'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Lists all available n8n nodes with comprehensive filtering options. Can filter by category, package, trigger status, and more. Returns complete node metadata.',
|
||||
parameters: {
|
||||
category: { type: 'string', description: 'Filter by category (e.g., "communication", "data")', required: false },
|
||||
limit: { type: 'number', description: 'Maximum results (default: 50)', required: false },
|
||||
offset: { type: 'number', description: 'Pagination offset', required: false },
|
||||
onlyTriggers: { type: 'boolean', description: 'Only show trigger nodes', required: false },
|
||||
onlyAITools: { type: 'boolean', description: 'Only show AI-capable nodes', required: false },
|
||||
package: { type: 'string', description: 'Filter by package name', required: false }
|
||||
},
|
||||
returns: 'Array of nodes with complete metadata including type, name, description, category',
|
||||
examples: [
|
||||
'list_nodes() - Get first 50 nodes',
|
||||
'list_nodes({category: "trigger"}) - All trigger nodes',
|
||||
'list_nodes({onlyAITools: true}) - Nodes marked as AI tools',
|
||||
'list_nodes({package: "n8n-nodes-base", limit: 100}) - Core nodes'
|
||||
],
|
||||
useCases: [
|
||||
'Browsing available nodes by category',
|
||||
'Finding all triggers or webhooks',
|
||||
'Discovering AI-capable nodes',
|
||||
'Getting overview of available integrations'
|
||||
],
|
||||
performance: 'Fast - uses indexed queries. Returns in <100ms even for large result sets.',
|
||||
bestPractices: [
|
||||
'Use categories for focused browsing',
|
||||
'Combine with search_nodes for keyword search',
|
||||
'Use pagination for large result sets',
|
||||
'Check onlyTriggers for workflow starting points'
|
||||
],
|
||||
pitfalls: [
|
||||
'No text search - use search_nodes for that',
|
||||
'Categories are predefined, not all nodes have them',
|
||||
'Large result sets without limit can be overwhelming'
|
||||
],
|
||||
relatedTools: ['search_nodes', 'list_ai_tools', 'get_node_essentials']
|
||||
}
|
||||
},
|
||||
|
||||
validate_node_minimal: {
|
||||
name: 'validate_node_minimal',
|
||||
category: 'validation',
|
||||
essentials: {
|
||||
description: 'Quick validation checking only required fields',
|
||||
keyParameters: ['nodeType', 'config'],
|
||||
example: 'validate_node_minimal("n8n-nodes-base.slack", {resource: "message", operation: "post"})',
|
||||
performance: 'Very fast - minimal checks only',
|
||||
tips: [
|
||||
'Use for quick validation during configuration',
|
||||
'Follow up with validate_node_operation for full validation'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Performs minimal validation checking only required fields. Fastest validation option, perfect for iterative configuration. Checks if all required fields are present without complex dependency validation.',
|
||||
parameters: {
|
||||
nodeType: { type: 'string', description: 'Full node type', required: true },
|
||||
config: { type: 'object', description: 'Node configuration to validate', required: true }
|
||||
},
|
||||
returns: 'Object with isValid boolean, missing required fields, and basic feedback',
|
||||
examples: [
|
||||
'validate_node_minimal("n8n-nodes-base.httpRequest", {url: "https://api.example.com"})',
|
||||
'validate_node_minimal("n8n-nodes-base.slack", {resource: "message", operation: "post", channel: "general"})'
|
||||
],
|
||||
useCases: [
|
||||
'Quick validation during iterative configuration',
|
||||
'Checking if minimum requirements are met',
|
||||
'Fast feedback loop while building',
|
||||
'Pre-validation before full check'
|
||||
],
|
||||
performance: 'Extremely fast - only checks required fields. Typically <10ms.',
|
||||
bestPractices: [
|
||||
'Use during configuration for quick feedback',
|
||||
'Follow with validate_node_operation for complete validation',
|
||||
'Great for iterative development',
|
||||
'Combine with get_node_essentials for requirements'
|
||||
],
|
||||
pitfalls: [
|
||||
'Doesn\'t check field dependencies',
|
||||
'Won\'t catch configuration conflicts',
|
||||
'Missing optional but recommended fields'
|
||||
],
|
||||
relatedTools: ['validate_node_operation', 'get_node_essentials', 'validate_workflow']
|
||||
}
|
||||
},
|
||||
|
||||
validate_node_operation: {
|
||||
name: 'validate_node_operation',
|
||||
category: 'validation',
|
||||
essentials: {
|
||||
description: 'Full validation with operation-aware checking and helpful suggestions',
|
||||
keyParameters: ['nodeType', 'config', 'profile'],
|
||||
example: 'validate_node_operation("n8n-nodes-base.slack", {resource: "message", operation: "post", channel: "general"})',
|
||||
performance: 'Moderate - comprehensive validation',
|
||||
tips: [
|
||||
'Provides specific error messages and fixes',
|
||||
'Use "strict" profile for production workflows'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Comprehensive validation that understands operation-specific requirements. Checks dependencies, validates field values, and provides helpful suggestions for fixing issues.',
|
||||
parameters: {
|
||||
nodeType: { type: 'string', description: 'Full node type', required: true },
|
||||
config: { type: 'object', description: 'Complete node configuration', required: true },
|
||||
profile: { type: 'string', description: 'Validation profile: "development" or "strict"', required: false }
|
||||
},
|
||||
returns: 'Detailed validation results with errors, warnings, suggestions, and fixes',
|
||||
examples: [
|
||||
'validate_node_operation("n8n-nodes-base.httpRequest", {method: "POST", url: "{{$json.url}}", bodyParametersUi: {...}})',
|
||||
'validate_node_operation("n8n-nodes-base.postgres", {operation: "executeQuery", query: "SELECT * FROM users"}, "strict")'
|
||||
],
|
||||
useCases: [
|
||||
'Final validation before deployment',
|
||||
'Understanding complex field dependencies',
|
||||
'Getting suggestions for configuration improvements',
|
||||
'Validating operation-specific requirements'
|
||||
],
|
||||
performance: 'Moderate speed - performs comprehensive checks. 50-200ms depending on complexity.',
|
||||
bestPractices: [
|
||||
'Use after validate_node_minimal passes',
|
||||
'Apply suggested fixes from response',
|
||||
'Use strict profile for production',
|
||||
'Check warnings even if validation passes'
|
||||
],
|
||||
pitfalls: [
|
||||
'Slower than minimal validation',
|
||||
'May be overkill for simple configurations',
|
||||
'Strict profile might be too restrictive for development'
|
||||
],
|
||||
relatedTools: ['validate_node_minimal', 'validate_workflow', 'get_property_dependencies']
|
||||
}
|
||||
},
|
||||
|
||||
get_node_for_task: {
|
||||
name: 'get_node_for_task',
|
||||
category: 'templates',
|
||||
essentials: {
|
||||
description: 'Get pre-configured node settings for common tasks',
|
||||
keyParameters: ['task'],
|
||||
example: 'get_node_for_task("send_slack_message")',
|
||||
performance: 'Instant - returns pre-built configurations',
|
||||
tips: [
|
||||
'Use list_tasks() to see all available tasks',
|
||||
'Look for userMustProvide fields to complete'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Returns pre-configured node settings for common automation tasks. Each template includes the correct node type, operation settings, and clear markers for what needs user input.',
|
||||
parameters: {
|
||||
task: { type: 'string', description: 'Task identifier (use list_tasks to see all)', required: true }
|
||||
},
|
||||
returns: 'Complete node configuration with parameters, position, and user guidance',
|
||||
examples: [
|
||||
'get_node_for_task("send_slack_message") - Slack message template',
|
||||
'get_node_for_task("receive_webhook") - Webhook trigger setup',
|
||||
'get_node_for_task("query_database") - Database query template'
|
||||
],
|
||||
useCases: [
|
||||
'Quickly setting up common automation patterns',
|
||||
'Learning correct node configurations',
|
||||
'Avoiding configuration mistakes',
|
||||
'Rapid workflow prototyping'
|
||||
],
|
||||
performance: 'Instant - returns static templates. No computation required.',
|
||||
bestPractices: [
|
||||
'Check userMustProvide fields for required inputs',
|
||||
'Use list_tasks() to discover available templates',
|
||||
'Validate with validate_node_minimal after filling in',
|
||||
'Use as starting point, then customize'
|
||||
],
|
||||
pitfalls: [
|
||||
'Templates are generic - customize for specific needs',
|
||||
'Not all tasks have templates',
|
||||
'Some fields marked userMustProvide are critical'
|
||||
],
|
||||
relatedTools: ['list_tasks', 'get_node_essentials', 'validate_node_minimal']
|
||||
}
|
||||
},
|
||||
|
||||
n8n_create_workflow: {
|
||||
name: 'n8n_create_workflow',
|
||||
category: 'workflow_management',
|
||||
essentials: {
|
||||
description: 'Create a new workflow in n8n via API',
|
||||
keyParameters: ['name', 'nodes', 'connections'],
|
||||
example: 'n8n_create_workflow({name: "My Workflow", nodes: [...], connections: {...}})',
|
||||
performance: 'API call - depends on n8n instance',
|
||||
tips: [
|
||||
'ALWAYS use node names in connections, never IDs',
|
||||
'Requires N8N_API_URL and N8N_API_KEY configuration'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Creates a new workflow in your n8n instance via API. Requires proper API configuration. Returns the created workflow with assigned ID.',
|
||||
parameters: {
|
||||
name: { type: 'string', description: 'Workflow name', required: true },
|
||||
nodes: { type: 'array', description: 'Array of node configurations', required: true },
|
||||
connections: { type: 'object', description: 'Node connections (use names!)', required: true },
|
||||
settings: { type: 'object', description: 'Workflow settings', required: false },
|
||||
tags: { type: 'array', description: 'Tag IDs (not names)', required: false }
|
||||
},
|
||||
returns: 'Created workflow object with id, name, nodes, connections, and metadata',
|
||||
examples: [
|
||||
`n8n_create_workflow({
|
||||
name: "Slack Notification",
|
||||
nodes: [
|
||||
{id: "1", name: "Webhook", type: "n8n-nodes-base.webhook", position: [250, 300]},
|
||||
{id: "2", name: "Slack", type: "n8n-nodes-base.slack", position: [450, 300], parameters: {...}}
|
||||
],
|
||||
connections: {
|
||||
"Webhook": {main: [[{node: "Slack", type: "main", index: 0}]]}
|
||||
}
|
||||
})`
|
||||
],
|
||||
useCases: [
|
||||
'Deploying workflows programmatically',
|
||||
'Automating workflow creation',
|
||||
'Migrating workflows between instances',
|
||||
'Creating workflows from templates'
|
||||
],
|
||||
performance: 'Depends on n8n instance and network. Typically 100-500ms.',
|
||||
bestPractices: [
|
||||
'CRITICAL: Use node NAMES in connections, not IDs',
|
||||
'Validate workflow before creating',
|
||||
'Use meaningful workflow names',
|
||||
'Check n8n_health_check before creating',
|
||||
'Handle API errors gracefully'
|
||||
],
|
||||
pitfalls: [
|
||||
'Using node IDs in connections breaks UI display',
|
||||
'Workflow not automatically activated',
|
||||
'Tags must exist (use tag IDs not names)',
|
||||
'API must be configured correctly'
|
||||
],
|
||||
relatedTools: ['validate_workflow', 'n8n_update_partial_workflow', 'n8n_list_workflows']
|
||||
}
|
||||
},
|
||||
|
||||
n8n_update_partial_workflow: {
|
||||
name: 'n8n_update_partial_workflow',
|
||||
category: 'workflow_management',
|
||||
essentials: {
|
||||
description: 'Update workflows using diff operations - only send changes, not entire workflow',
|
||||
keyParameters: ['id', 'operations'],
|
||||
example: 'n8n_update_partial_workflow({id: "123", operations: [{type: "updateNode", nodeId: "Slack", updates: {...}}]})',
|
||||
performance: '80-90% more efficient than full updates',
|
||||
tips: [
|
||||
'Maximum 5 operations per request',
|
||||
'Can reference nodes by name or ID'
|
||||
]
|
||||
},
|
||||
full: {
|
||||
description: 'Update existing workflows using diff operations. Much more efficient than full updates as it only sends the changes. Supports 13 different operation types.',
|
||||
parameters: {
|
||||
id: { type: 'string', description: 'Workflow ID to update', required: true },
|
||||
operations: { type: 'array', description: 'Array of diff operations (max 5)', required: true },
|
||||
validateOnly: { type: 'boolean', description: 'Only validate without applying', required: false }
|
||||
},
|
||||
returns: 'Updated workflow with applied changes and operation results',
|
||||
examples: [
|
||||
`// Update node parameters
|
||||
n8n_update_partial_workflow({
|
||||
id: "123",
|
||||
operations: [{
|
||||
type: "updateNode",
|
||||
nodeId: "Slack",
|
||||
updates: {parameters: {channel: "general"}}
|
||||
}]
|
||||
})`,
|
||||
`// Add connection between nodes
|
||||
n8n_update_partial_workflow({
|
||||
id: "123",
|
||||
operations: [{
|
||||
type: "addConnection",
|
||||
from: "HTTP Request",
|
||||
to: "Slack",
|
||||
fromOutput: "main",
|
||||
toInput: "main"
|
||||
}]
|
||||
})`
|
||||
],
|
||||
useCases: [
|
||||
'Updating node configurations',
|
||||
'Adding/removing connections',
|
||||
'Enabling/disabling nodes',
|
||||
'Moving nodes in canvas',
|
||||
'Updating workflow metadata'
|
||||
],
|
||||
performance: 'Very efficient - only sends changes. 80-90% less data than full updates.',
|
||||
bestPractices: [
|
||||
'Batch related operations together',
|
||||
'Use validateOnly:true to test first',
|
||||
'Reference nodes by name for clarity',
|
||||
'Keep under 5 operations per request',
|
||||
'Check operation results for success'
|
||||
],
|
||||
pitfalls: [
|
||||
'Maximum 5 operations per request',
|
||||
'Some operations have dependencies',
|
||||
'Node must exist for update operations',
|
||||
'Connection nodes must both exist'
|
||||
],
|
||||
relatedTools: ['n8n_get_workflow', 'n8n_update_full_workflow', 'validate_workflow']
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function getToolDocumentation(toolName: string, depth: 'essentials' | 'full' = 'essentials'): string {
|
||||
const tool = toolsDocumentation[toolName];
|
||||
if (!tool) {
|
||||
return `Tool '${toolName}' not found. Use tools_documentation() to see available tools.`;
|
||||
}
|
||||
|
||||
if (depth === 'essentials') {
|
||||
const { essentials } = tool;
|
||||
return `# ${tool.name}
|
||||
|
||||
${essentials.description}
|
||||
|
||||
**Example**: ${essentials.example}
|
||||
|
||||
**Key parameters**: ${essentials.keyParameters.join(', ')}
|
||||
|
||||
**Performance**: ${essentials.performance}
|
||||
|
||||
**Tips**:
|
||||
${essentials.tips.map(tip => `- ${tip}`).join('\n')}
|
||||
|
||||
For full documentation, use: tools_documentation({topic: "${toolName}", depth: "full"})`;
|
||||
}
|
||||
|
||||
// Full documentation
|
||||
const { full } = tool;
|
||||
return `# ${tool.name}
|
||||
|
||||
${full.description}
|
||||
|
||||
## Parameters
|
||||
${Object.entries(full.parameters).map(([param, info]) =>
|
||||
`- **${param}** (${info.type}${info.required ? ', required' : ''}): ${info.description}`
|
||||
).join('\n')}
|
||||
|
||||
## Returns
|
||||
${full.returns}
|
||||
|
||||
## Examples
|
||||
${full.examples.map(ex => `\`\`\`javascript\n${ex}\n\`\`\``).join('\n\n')}
|
||||
|
||||
## Common Use Cases
|
||||
${full.useCases.map(uc => `- ${uc}`).join('\n')}
|
||||
|
||||
## Performance
|
||||
${full.performance}
|
||||
|
||||
## Best Practices
|
||||
${full.bestPractices.map(bp => `- ${bp}`).join('\n')}
|
||||
|
||||
## Common Pitfalls
|
||||
${full.pitfalls.map(p => `- ${p}`).join('\n')}
|
||||
|
||||
## Related Tools
|
||||
${full.relatedTools.map(t => `- ${t}`).join('\n')}`;
|
||||
}
|
||||
|
||||
export function getToolsOverview(depth: 'essentials' | 'full' = 'essentials'): string {
|
||||
if (depth === 'essentials') {
|
||||
return `# n8n MCP Tools Quick Reference
|
||||
|
||||
Welcome! Here's how to efficiently work with n8n nodes:
|
||||
|
||||
## Essential Workflow
|
||||
1. **Find**: search_nodes({query: "slack"})
|
||||
2. **Configure**: get_node_essentials("n8n-nodes-base.slack")
|
||||
3. **Validate**: validate_node_minimal() → validate_node_operation()
|
||||
4. **Deploy**: n8n_create_workflow() (if API configured)
|
||||
|
||||
## Key Tips
|
||||
- Always use get_node_essentials instead of get_node_info (95% smaller!)
|
||||
- Use node NAMES in connections, never IDs
|
||||
- Try get_node_for_task() for common patterns
|
||||
- Call validate_node_minimal() for quick checks
|
||||
|
||||
## Get Help
|
||||
- tools_documentation({topic: "search_nodes"}) - Get help for specific tool
|
||||
- tools_documentation({topic: "overview", depth: "full"}) - See complete guide
|
||||
- list_tasks() - See available task templates
|
||||
|
||||
Available tools: ${Object.keys(toolsDocumentation).join(', ')}`;
|
||||
}
|
||||
|
||||
// Full overview
|
||||
return `# n8n MCP Tools Complete Guide
|
||||
|
||||
## Overview
|
||||
The n8n MCP provides 39 tools to help you discover, configure, validate, and deploy n8n workflows. Tools are organized into categories for easy discovery.
|
||||
|
||||
## Tool Categories
|
||||
|
||||
### Discovery Tools
|
||||
- **search_nodes**: Find nodes by keyword (uses OR logic)
|
||||
- **list_nodes**: Browse nodes by category, package, or type
|
||||
- **list_ai_tools**: See all AI-capable nodes (263 available)
|
||||
|
||||
### Configuration Tools
|
||||
- **get_node_essentials**: Get key properties only (<5KB vs 100KB+)
|
||||
- **get_node_info**: Get complete node details (use sparingly)
|
||||
- **search_node_properties**: Find specific properties in large nodes
|
||||
- **get_property_dependencies**: Understand field relationships
|
||||
|
||||
### Validation Tools
|
||||
- **validate_node_minimal**: Quick required field check
|
||||
- **validate_node_operation**: Full operation-aware validation
|
||||
- **validate_workflow**: Complete workflow validation
|
||||
- **validate_workflow_connections**: Check node connections
|
||||
- **validate_workflow_expressions**: Validate n8n expressions
|
||||
|
||||
### Task & Template Tools
|
||||
- **list_tasks**: See available task templates
|
||||
- **get_node_for_task**: Get pre-configured nodes
|
||||
- **list_node_templates**: Find workflow templates
|
||||
- **search_templates**: Search template library
|
||||
|
||||
### Workflow Management (requires API config)
|
||||
- **n8n_create_workflow**: Create new workflows
|
||||
- **n8n_update_partial_workflow**: Efficient diff-based updates
|
||||
- **n8n_update_full_workflow**: Replace entire workflow
|
||||
- **n8n_list_workflows**: List workflows with filtering
|
||||
|
||||
## Recommended Patterns
|
||||
|
||||
### Building a Simple Workflow
|
||||
\`\`\`javascript
|
||||
// 1. Find what you need
|
||||
search_nodes({query: "webhook"})
|
||||
search_nodes({query: "slack"})
|
||||
|
||||
// 2. Get configurations
|
||||
get_node_essentials("n8n-nodes-base.webhook")
|
||||
get_node_essentials("n8n-nodes-base.slack")
|
||||
|
||||
// 3. Build and validate
|
||||
const workflow = {
|
||||
name: "My Webhook to Slack",
|
||||
nodes: [...],
|
||||
connections: {"Webhook": {main: [[{node: "Slack", type: "main", index: 0}]]}}
|
||||
};
|
||||
validate_workflow(workflow)
|
||||
|
||||
// 4. Deploy (if API configured)
|
||||
n8n_create_workflow(workflow)
|
||||
\`\`\`
|
||||
|
||||
### Using AI Tools
|
||||
Any node can be an AI tool! Connect it to an AI Agent's ai_tool port:
|
||||
\`\`\`javascript
|
||||
get_node_as_tool_info("n8n-nodes-base.slack")
|
||||
// Returns how to configure Slack as an AI tool
|
||||
\`\`\`
|
||||
|
||||
### Efficient Updates
|
||||
Use partial updates to save 80-90% bandwidth:
|
||||
\`\`\`javascript
|
||||
n8n_update_partial_workflow({
|
||||
id: "workflow-id",
|
||||
operations: [
|
||||
{type: "updateNode", nodeId: "Slack", updates: {parameters: {channel: "general"}}}
|
||||
]
|
||||
})
|
||||
\`\`\`
|
||||
|
||||
## Performance Guide
|
||||
- **Fastest**: get_node_essentials, validate_node_minimal, list_tasks
|
||||
- **Fast**: search_nodes, list_nodes, get_node_for_task
|
||||
- **Moderate**: validate_node_operation, n8n_update_partial_workflow
|
||||
- **Slow**: get_node_info (100KB+), validate_workflow (full analysis)
|
||||
|
||||
## Common Pitfalls to Avoid
|
||||
1. Using get_node_info when get_node_essentials would work
|
||||
2. Using node IDs instead of names in connections
|
||||
3. Not validating before creating workflows
|
||||
4. Searching with long phrases instead of keywords
|
||||
5. Forgetting to configure N8N_API_URL for management tools
|
||||
|
||||
## Getting More Help
|
||||
- Use tools_documentation({topic: "toolname"}) for any tool
|
||||
- Check CLAUDE.md for latest updates and examples
|
||||
- Run n8n_health_check() to verify API connectivity`;
|
||||
}
|
||||
|
||||
export function searchToolDocumentation(query: string): string[] {
|
||||
const results: string[] = [];
|
||||
const searchTerms = query.toLowerCase().split(' ');
|
||||
|
||||
for (const [toolName, tool] of Object.entries(toolsDocumentation)) {
|
||||
const searchText = `${toolName} ${tool.essentials.description} ${tool.category}`.toLowerCase();
|
||||
if (searchTerms.some(term => searchText.includes(term))) {
|
||||
results.push(toolName);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
export function getToolsByCategory(category: string): string[] {
|
||||
return Object.entries(toolsDocumentation)
|
||||
.filter(([_, tool]) => tool.category === category)
|
||||
.map(([name, _]) => name);
|
||||
}
|
||||
|
||||
export function getAllCategories(): string[] {
|
||||
const categories = new Set<string>();
|
||||
Object.values(toolsDocumentation).forEach(tool => {
|
||||
categories.add(tool.category);
|
||||
});
|
||||
return Array.from(categories);
|
||||
}
|
||||
@@ -8,15 +8,20 @@ import { ToolDefinition } from '../types';
|
||||
*/
|
||||
export const n8nDocumentationToolsFinal: ToolDefinition[] = [
|
||||
{
|
||||
name: 'start_here_workflow_guide',
|
||||
description: `START HERE! Essential guide for using n8n MCP tools effectively. Returns workflow recommendations, common patterns, performance tips, and known issues. Call this FIRST before using other tools to avoid common mistakes and work efficiently.`,
|
||||
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',
|
||||
enum: ['overview', 'workflow', 'search_tips', 'common_nodes', 'known_issues', 'performance', 'ai_tools', 'n8n_management'],
|
||||
description: 'Optional: Get specific guidance on a topic. Default returns complete overview.',
|
||||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user