mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-06 05:23:08 +00:00
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>
This commit is contained in:
@@ -1031,7 +1031,7 @@ describe('handlers-n8n-manager', () => {
|
||||
'1. Verify n8n instance is running',
|
||||
'2. Check N8N_API_URL is correct',
|
||||
'3. Verify N8N_API_KEY has proper permissions',
|
||||
'4. Run n8n_diagnostic for detailed analysis',
|
||||
'4. Run n8n_health_check with mode="diagnostic" for detailed analysis',
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -399,24 +399,11 @@ describe('Parameter Validation', () => {
|
||||
expect(result).toEqual({ docs: 'test' });
|
||||
});
|
||||
|
||||
it('should allow list_nodes with no parameters', async () => {
|
||||
const result = await server.testExecuteTool('list_nodes', {});
|
||||
expect(result).toEqual({ nodes: [] });
|
||||
});
|
||||
|
||||
it('should allow list_ai_tools with no parameters', async () => {
|
||||
const result = await server.testExecuteTool('list_ai_tools', {});
|
||||
expect(result).toEqual({ tools: [] });
|
||||
});
|
||||
|
||||
it('should allow get_database_statistics with no parameters', async () => {
|
||||
const result = await server.testExecuteTool('get_database_statistics', {});
|
||||
expect(result).toEqual({ stats: {} });
|
||||
});
|
||||
|
||||
it('should allow list_tasks with no parameters', async () => {
|
||||
const result = await server.testExecuteTool('list_tasks', {});
|
||||
expect(result).toEqual({ tasks: [] });
|
||||
it('should allow tools_documentation with no parameters', async () => {
|
||||
const result = await server.testExecuteTool('tools_documentation', {});
|
||||
expect(result).toBeDefined();
|
||||
// tools_documentation returns an object with documentation content
|
||||
expect(typeof result).toBe('object');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -476,8 +463,8 @@ describe('Parameter Validation', () => {
|
||||
{ name: 'get_node_documentation', args: {}, expected: 'Missing required parameters for get_node_documentation: nodeType' },
|
||||
{ name: 'search_node_properties', args: {}, expected: 'Missing required parameters for search_node_properties: nodeType, query' },
|
||||
// Note: get_node_for_task removed in v2.15.0
|
||||
// Note: get_node_as_tool_info removed in v2.25.0
|
||||
{ name: 'get_property_dependencies', args: {}, expected: 'Missing required parameters for get_property_dependencies: nodeType' },
|
||||
{ name: 'get_node_as_tool_info', args: {}, expected: 'Missing required parameters for get_node_as_tool_info: nodeType' },
|
||||
{ name: 'get_template', args: {}, expected: 'Missing required parameters for get_template: templateId' },
|
||||
];
|
||||
|
||||
|
||||
@@ -78,31 +78,6 @@ describe('n8nDocumentationToolsFinal', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('list_nodes', () => {
|
||||
const tool = n8nDocumentationToolsFinal.find(t => t.name === 'list_nodes');
|
||||
|
||||
it('should exist', () => {
|
||||
expect(tool).toBeDefined();
|
||||
});
|
||||
|
||||
it('should have correct schema properties', () => {
|
||||
const properties = tool?.inputSchema.properties;
|
||||
expect(properties).toHaveProperty('package');
|
||||
expect(properties).toHaveProperty('category');
|
||||
expect(properties).toHaveProperty('developmentStyle');
|
||||
expect(properties).toHaveProperty('isAITool');
|
||||
expect(properties).toHaveProperty('limit');
|
||||
});
|
||||
|
||||
it('should have correct defaults', () => {
|
||||
expect(tool?.inputSchema.properties.limit.default).toBe(50);
|
||||
});
|
||||
|
||||
it('should have proper enum values', () => {
|
||||
expect(tool?.inputSchema.properties.developmentStyle.enum).toEqual(['declarative', 'programmatic']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('get_node', () => {
|
||||
const tool = n8nDocumentationToolsFinal.find(t => t.name === 'get_node');
|
||||
|
||||
@@ -205,7 +180,6 @@ describe('n8nDocumentationToolsFinal', () => {
|
||||
|
||||
it('should include examples or key information in descriptions', () => {
|
||||
const toolsWithExamples = [
|
||||
'list_nodes',
|
||||
'get_node',
|
||||
'search_nodes',
|
||||
'get_node_documentation'
|
||||
@@ -250,14 +224,14 @@ describe('n8nDocumentationToolsFinal', () => {
|
||||
describe('Tool Categories Coverage', () => {
|
||||
it('should have tools for all major categories', () => {
|
||||
const categories = {
|
||||
discovery: ['list_nodes', 'search_nodes', 'list_ai_tools'],
|
||||
discovery: ['search_nodes'],
|
||||
configuration: ['get_node', 'get_node_documentation'],
|
||||
validation: ['validate_node_operation', 'validate_workflow', 'validate_node_minimal'],
|
||||
templates: ['list_tasks', 'search_templates', 'list_templates', 'get_template', 'list_node_templates'], // get_node_for_task removed in v2.15.0
|
||||
templates: ['search_templates', 'get_template', 'list_node_templates', 'get_templates_for_task', 'search_templates_by_metadata'],
|
||||
documentation: ['tools_documentation']
|
||||
};
|
||||
|
||||
Object.entries(categories).forEach(([category, expectedTools]) => {
|
||||
Object.entries(categories).forEach(([_category, expectedTools]) => {
|
||||
expectedTools.forEach(toolName => {
|
||||
const tool = n8nDocumentationToolsFinal.find(t => t.name === toolName);
|
||||
expect(tool).toBeDefined();
|
||||
@@ -294,13 +268,15 @@ describe('n8nDocumentationToolsFinal', () => {
|
||||
});
|
||||
|
||||
describe('Edge Cases', () => {
|
||||
it('should handle tools with no parameters', () => {
|
||||
const toolsWithNoParams = ['list_ai_tools', 'get_database_statistics'];
|
||||
|
||||
toolsWithNoParams.forEach(toolName => {
|
||||
it('should handle tools with optional parameters only', () => {
|
||||
// Tools where all parameters are optional
|
||||
const toolsWithOptionalParams = ['tools_documentation'];
|
||||
|
||||
toolsWithOptionalParams.forEach(toolName => {
|
||||
const tool = n8nDocumentationToolsFinal.find(t => t.name === toolName);
|
||||
expect(tool).toBeDefined();
|
||||
expect(Object.keys(tool?.inputSchema.properties || {}).length).toBe(0);
|
||||
// These tools have properties but no required array or empty required array
|
||||
expect(tool?.inputSchema.required === undefined || tool?.inputSchema.required?.length === 0).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -318,37 +294,6 @@ describe('n8nDocumentationToolsFinal', () => {
|
||||
});
|
||||
|
||||
describe('New Template Tools', () => {
|
||||
describe('list_templates', () => {
|
||||
const tool = n8nDocumentationToolsFinal.find(t => t.name === 'list_templates');
|
||||
|
||||
it('should exist and be properly defined', () => {
|
||||
expect(tool).toBeDefined();
|
||||
expect(tool?.description).toContain('minimal data');
|
||||
});
|
||||
|
||||
it('should have correct parameters', () => {
|
||||
expect(tool?.inputSchema.properties).toHaveProperty('limit');
|
||||
expect(tool?.inputSchema.properties).toHaveProperty('offset');
|
||||
expect(tool?.inputSchema.properties).toHaveProperty('sortBy');
|
||||
|
||||
const limitParam = tool?.inputSchema.properties.limit;
|
||||
expect(limitParam.type).toBe('number');
|
||||
expect(limitParam.minimum).toBe(1);
|
||||
expect(limitParam.maximum).toBe(100);
|
||||
|
||||
const offsetParam = tool?.inputSchema.properties.offset;
|
||||
expect(offsetParam.type).toBe('number');
|
||||
expect(offsetParam.minimum).toBe(0);
|
||||
|
||||
const sortByParam = tool?.inputSchema.properties.sortBy;
|
||||
expect(sortByParam.enum).toEqual(['views', 'created_at', 'name']);
|
||||
});
|
||||
|
||||
it('should have no required parameters', () => {
|
||||
expect(tool?.inputSchema.required).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('get_template (enhanced)', () => {
|
||||
const tool = n8nDocumentationToolsFinal.find(t => t.name === 'get_template');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user