fix: enhance node type format normalization for better AI agent compatibility (Issue #74)

- Added support for n8n-nodes-langchain.* → nodes-langchain.* normalization
- Implemented case-insensitive node name matching (e.g., chattrigger → chatTrigger)
- Added smart camelCase detection for common patterns (trigger, request, sheets, etc.)
- Fixed get_node_documentation tool to use same normalization logic as other tools
- Updated all 7 node lookup locations to use normalized types for alternatives
- Enhanced getNodeTypeAlternatives() to normalize all generated alternatives

All MCP tools now consistently handle various format variations:
- nodes-langchain.chatTrigger (correct format)
- n8n-nodes-langchain.chatTrigger (package format)
- n8n-nodes-langchain.chattrigger (package + wrong case)
- nodes-langchain.chattrigger (wrong case only)
- @n8n/n8n-nodes-langchain.chatTrigger (full npm format)

Bump version to 2.7.19

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-07-18 16:25:20 +02:00
parent a7bcd8cd1b
commit f76e2247f9
7 changed files with 124 additions and 11 deletions

View File

@@ -354,7 +354,7 @@ export class N8NDocumentationMCPServer {
if (!node) {
// Fallback to other alternatives for edge cases
const alternatives = getNodeTypeAlternatives(nodeType);
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
const found = this.repository!.getNode(alt);
@@ -975,6 +975,21 @@ export class N8NDocumentationMCPServer {
`).get(nodeType) as NodeRow | undefined;
}
// If still not found, try alternatives
if (!node) {
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
node = this.db!.prepare(`
SELECT node_type, display_name, documentation, description
FROM nodes
WHERE node_type = ?
`).get(alt) as NodeRow | undefined;
if (node) break;
}
}
if (!node) {
throw new Error(`Node ${nodeType} not found`);
}
@@ -1072,7 +1087,7 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
if (!node) {
// Fallback to other alternatives for edge cases
const alternatives = getNodeTypeAlternatives(nodeType);
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
const found = this.repository!.getNode(alt);
@@ -1146,7 +1161,7 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
if (!node) {
// Fallback to other alternatives for edge cases
const alternatives = getNodeTypeAlternatives(nodeType);
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
const found = this.repository!.getNode(alt);
@@ -1304,7 +1319,7 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
if (!node) {
// Fallback to other alternatives for edge cases
const alternatives = getNodeTypeAlternatives(nodeType);
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
const found = this.repository!.getNode(alt);
@@ -1362,7 +1377,7 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
if (!node) {
// Fallback to other alternatives for edge cases
const alternatives = getNodeTypeAlternatives(nodeType);
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
const found = this.repository!.getNode(alt);
@@ -1416,7 +1431,7 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
if (!node) {
// Fallback to other alternatives for edge cases
const alternatives = getNodeTypeAlternatives(nodeType);
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
const found = this.repository!.getNode(alt);
@@ -1593,7 +1608,7 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
if (!node) {
// Fallback to other alternatives for edge cases
const alternatives = getNodeTypeAlternatives(nodeType);
const alternatives = getNodeTypeAlternatives(normalizedType);
for (const alt of alternatives) {
const found = this.repository!.getNode(alt);