feat: Tool Consolidation - Reduce MCP Tools by 38% (v2.26.0) (#439)

* 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>
This commit is contained in:
Romuald Członkowski
2025-11-25 18:39:00 +01:00
committed by GitHub
parent 9ee4b9492f
commit ff69e4ccca
28 changed files with 925 additions and 1766 deletions

View File

@@ -100,8 +100,8 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await client.connect(clientTransport);
// Make some requests
await client.callTool({ name: 'get_database_statistics', arguments: {} });
await client.callTool({ name: 'list_nodes', arguments: { limit: 5 } });
await client.callTool({ name: 'tools_documentation', arguments: {} });
await client.callTool({ name: 'search_nodes', arguments: { query: 'http', limit: 5 } });
// Clean termination
await client.close();
@@ -109,7 +109,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
// Client should be closed
try {
await client.callTool({ name: 'get_database_statistics', arguments: {} });
await client.callTool({ name: 'tools_documentation', arguments: {} });
expect.fail('Should not be able to make requests after close');
} catch (error) {
expect(error).toBeDefined();
@@ -133,7 +133,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await client.connect(clientTransport);
// Make a request to ensure connection is active
await client.callTool({ name: 'get_database_statistics', arguments: {} });
await client.callTool({ name: 'tools_documentation', arguments: {} });
// Simulate abrupt disconnection by closing transport
await clientTransport.close();
@@ -141,7 +141,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
// Further operations should fail
try {
await client.callTool({ name: 'list_nodes', arguments: {} });
await client.callTool({ name: 'search_nodes', arguments: { query: 'http' } });
expect.fail('Should not be able to make requests after transport close');
} catch (error) {
expect(error).toBeDefined();
@@ -179,14 +179,14 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await client1.connect(ct1);
// First session operations
const response1 = await client1.callTool({ name: 'list_nodes', arguments: { limit: 3 } });
const response1 = await client1.callTool({ name: 'search_nodes', arguments: { query: 'http', limit: 3 } });
expect(response1).toBeDefined();
expect((response1 as any).content).toBeDefined();
expect((response1 as any).content[0]).toHaveProperty('type', 'text');
const data1 = JSON.parse(((response1 as any).content[0] as any).text);
// Handle both array response and object with nodes property
const nodes1 = Array.isArray(data1) ? data1 : data1.nodes;
expect(nodes1).toHaveLength(3);
// Handle both array response and object with results property
const results1 = Array.isArray(data1) ? data1 : data1.results;
expect(results1.length).toBeLessThanOrEqual(3);
// Close first session completely
await client1.close();
@@ -204,14 +204,14 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await client2.connect(ct2);
// Second session operations
const response2 = await client2.callTool({ name: 'list_nodes', arguments: { limit: 5 } });
const response2 = await client2.callTool({ name: 'search_nodes', arguments: { query: 'http', limit: 5 } });
expect(response2).toBeDefined();
expect((response2 as any).content).toBeDefined();
expect((response2 as any).content[0]).toHaveProperty('type', 'text');
const data2 = JSON.parse(((response2 as any).content[0] as any).text);
// Handle both array response and object with nodes property
const nodes2 = Array.isArray(data2) ? data2 : data2.nodes;
expect(nodes2).toHaveLength(5);
// Handle both array response and object with results property
const results2 = Array.isArray(data2) ? data2 : data2.results;
expect(results2.length).toBeLessThanOrEqual(5);
// Clean up
await client2.close();
@@ -228,9 +228,9 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
const client1 = new Client({ name: 'multi-seq-1', version: '1.0.0' }, {});
await client1.connect(ct1);
const resp1 = await client1.callTool({ name: 'get_database_statistics', arguments: {} });
const resp1 = await client1.callTool({ name: 'tools_documentation', arguments: {} });
expect(resp1).toBeDefined();
await client1.close();
await new Promise(resolve => setTimeout(resolve, 50));
@@ -239,8 +239,8 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await mcpServer.connectToTransport(st2);
const client2 = new Client({ name: 'multi-seq-2', version: '1.0.0' }, {});
await client2.connect(ct2);
const resp2 = await client2.callTool({ name: 'get_database_statistics', arguments: {} });
const resp2 = await client2.callTool({ name: 'tools_documentation', arguments: {} });
expect(resp2).toBeDefined();
await client2.close();
@@ -261,14 +261,14 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await client1.connect(ct1);
// Make some requests
await client1.callTool({ name: 'list_nodes', arguments: { limit: 10 } });
await client1.callTool({ name: 'search_nodes', arguments: { query: 'http', limit: 10 } });
await client1.close();
await mcpServer1.close();
// Second session - should be fresh
const mcpServer2 = new TestableN8NMCPServer();
await mcpServer2.initialize();
const [st2, ct2] = InMemoryTransport.createLinkedPair();
await mcpServer2.connectToTransport(st2);
@@ -276,7 +276,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await client2.connect(ct2);
// Should work normally
const response = await client2.callTool({ name: 'get_database_statistics', arguments: {} });
const response = await client2.callTool({ name: 'tools_documentation', arguments: {} });
expect(response).toBeDefined();
await client2.close();
@@ -299,7 +299,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
await client.connect(clientTransport);
// Quick operation
const response = await client.callTool({ name: 'get_database_statistics', arguments: {} });
const response = await client.callTool({ name: 'tools_documentation', arguments: {} });
expect(response).toBeDefined();
// Explicit cleanup for each iteration
@@ -392,7 +392,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
// Light operation
if (i % 10 === 0) {
await client.callTool({ name: 'get_database_statistics', arguments: {} });
await client.callTool({ name: 'tools_documentation', arguments: {} });
}
// Explicit cleanup
@@ -420,8 +420,8 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
const promises = [];
for (let i = 0; i < requestCount; i++) {
const toolName = i % 2 === 0 ? 'list_nodes' : 'get_database_statistics';
const params = toolName === 'list_nodes' ? { limit: 1 } : {};
const toolName = i % 2 === 0 ? 'search_nodes' : 'tools_documentation';
const params = toolName === 'search_nodes' ? { query: 'http', limit: 1 } : {};
promises.push(client.callTool({ name: toolName as any, arguments: params }));
}
@@ -460,9 +460,9 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
}
// Session should still be active
const response = await client.callTool({ name: 'get_database_statistics', arguments: {} });
const response = await client.callTool({ name: 'tools_documentation', arguments: {} });
expect(response).toBeDefined();
await client.close();
await new Promise(resolve => setTimeout(resolve, 50)); // Give time for client to fully close
await mcpServer.close();
@@ -496,9 +496,9 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
});
// Session should still work
const response = await client.callTool({ name: 'list_nodes', arguments: { limit: 1 } });
const response = await client.callTool({ name: 'search_nodes', arguments: { query: 'http', limit: 1 } });
expect(response).toBeDefined();
await client.close();
await new Promise(resolve => setTimeout(resolve, 50)); // Give time for client to fully close
await mcpServer.close();
@@ -539,7 +539,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
resources.clients.push(client);
// Make a request to ensure connection is active
await client.callTool({ name: 'get_database_statistics', arguments: {} });
await client.callTool({ name: 'tools_documentation', arguments: {} });
}
// Verify all resources are active
@@ -586,7 +586,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
// 3. Verify cleanup by attempting operations (should fail)
for (let i = 0; i < resources.clients.length; i++) {
try {
await resources.clients[i].callTool({ name: 'get_database_statistics', arguments: {} });
await resources.clients[i].callTool({ name: 'tools_documentation', arguments: {} });
expect.fail('Client should be closed');
} catch (error) {
// Expected - client is closed
@@ -643,9 +643,9 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
}, {});
await client.connect(ct1);
// Initial request
const response1 = await client.callTool({ name: 'get_database_statistics', arguments: {} });
const response1 = await client.callTool({ name: 'tools_documentation', arguments: {} });
expect(response1).toBeDefined();
// Close first client
@@ -654,7 +654,7 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
// New connection with same server
const [st2, ct2] = InMemoryTransport.createLinkedPair();
const connectTimeout = setTimeout(() => {
throw new Error('Second connection timeout');
}, 3000);
@@ -673,14 +673,14 @@ describe('MCP Session Management', { timeout: 15000 }, () => {
}, {});
await newClient.connect(ct2);
// Should work normally
const callTimeout = setTimeout(() => {
throw new Error('Second call timeout');
}, 3000);
try {
const response2 = await newClient.callTool({ name: 'get_database_statistics', arguments: {} });
const response2 = await newClient.callTool({ name: 'tools_documentation', arguments: {} });
clearTimeout(callTimeout);
expect(response2).toBeDefined();
} catch (error) {