Files
n8n-mcp/src/mcp/tool-docs/templates/get-template.ts
Romuald Członkowski 808088f25e docs: fix connection keys documentation to say "node names" not "node IDs" (#510) (#511)
The documentation incorrectly stated connection keys should be "node IDs"
when n8n actually requires "node names". This caused workflow creation
failures for AI-generated workflows.

Changes:
- tools-n8n-manager.ts: "Keys are source node names (the name field, not id)"
- n8n-create-workflow.ts: "Keys are source node names (not IDs)"
- Fixed example: "Webhook"/"Slack" instead of "webhook_1"/"slack_1"
- get-template.ts: clarified "source node names"

Closes #510

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

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

Co-authored-by: Romuald Członkowski <romualdczlonkowski@MacBook-Pro-Romuald.local>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 14:50:58 +01:00

82 lines
3.8 KiB
TypeScript

import { ToolDocumentation } from '../types';
export const getTemplateDoc: ToolDocumentation = {
name: 'get_template',
category: 'templates',
essentials: {
description: 'Get workflow template by ID with configurable detail level. Ready to import. IDs from search_templates.',
keyParameters: ['templateId', 'mode'],
example: 'get_template({templateId: 1234, mode: "full"})',
performance: 'Fast (<100ms) - single database lookup',
tips: [
'Get template IDs from search_templates first',
'Use mode="nodes_only" for quick overview, "structure" for topology, "full" for import',
'Returns complete workflow JSON ready for import into n8n'
]
},
full: {
description: `Retrieves the complete workflow JSON for a specific template by its ID. The returned workflow can be directly imported into n8n through the UI or API. This tool fetches pre-built workflows from the community template library containing 2,700+ curated workflows.`,
parameters: {
templateId: {
type: 'number',
required: true,
description: 'The numeric ID of the template to retrieve. Get IDs from search_templates'
},
mode: {
type: 'string',
required: false,
description: 'Response detail level: "nodes_only" (minimal - just node list), "structure" (nodes + connections), "full" (complete workflow JSON, default)',
default: 'full',
enum: ['nodes_only', 'structure', 'full']
}
},
returns: `Returns an object containing:
- template: Complete template information including workflow JSON
- id: Template ID
- name: Template name
- description: What the workflow does
- author: Creator information (name, username, verified status)
- nodes: Array of node types used
- views: Number of times viewed
- created: Creation date
- url: Link to template on n8n.io
- workflow: Complete workflow JSON with structure:
- nodes: Array of node objects (id, name, type, typeVersion, position, parameters)
- connections: Object mapping source node names to targets
- settings: Workflow configuration (timezone, error handling, etc.)
- usage: Instructions for using the workflow`,
examples: [
'get_template({templateId: 1234}) - Get complete workflow (default mode="full")',
'get_template({templateId: 1234, mode: "nodes_only"}) - Get just the node list',
'get_template({templateId: 1234, mode: "structure"}) - Get nodes and connections',
'get_template({templateId: 5678, mode: "full"}) - Get complete workflow JSON for import'
],
useCases: [
'Download workflows for direct import into n8n',
'Study workflow patterns and best practices',
'Get complete workflow JSON for customization',
'Clone popular workflows for your use case',
'Learn how complex automations are built'
],
performance: `Fast performance with single database lookup:
- Query time: <10ms for template retrieval
- Workflow JSON parsing: <50ms
- Total response time: <100ms
- No network calls (uses local cache)`,
bestPractices: [
'Always check if template exists before attempting modifications',
'Review workflow nodes before importing to ensure compatibility',
'Save template JSON locally if planning multiple customizations',
'Check template creation date for most recent patterns',
'Verify all required credentials are configured before import'
],
pitfalls: [
'Template IDs change when database is refreshed',
'Some templates may use deprecated node versions',
'Credentials in templates are placeholders - configure your own',
'Not all templates work with all n8n versions',
'Template may reference external services you don\'t have access to'
],
relatedTools: ['search_templates', 'n8n_create_workflow']
}
};