feat: comprehensive parameter validation for MCP tools

- Add validateToolParams method with clear error messages
- Fix failing tests to expect new parameter validation errors
- Create comprehensive parameter validation test suite (52 tests)
- Add parameter validation for all n8n management tools
- Test numeric parameter conversion and edge cases
- Ensure consistent error format across all tools
- Verify MCP error response handling

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-08-01 09:33:57 +02:00
parent 12818443df
commit 6cdb52f56f
3 changed files with 637 additions and 9 deletions

View File

@@ -63,8 +63,8 @@ describe('MCP Error Handling', () => {
expect.fail('Should have thrown an error');
} catch (error: any) {
expect(error).toBeDefined();
// The error occurs when trying to call startsWith on undefined nodeType
expect(error.message).toContain("Cannot read properties of undefined");
// The error now properly validates required parameters
expect(error.message).toContain("Missing required parameters");
}
});
@@ -500,8 +500,8 @@ describe('MCP Error Handling', () => {
expect.fail('Should have thrown an error');
} catch (error: any) {
expect(error).toBeDefined();
// The error occurs when trying to access properties of undefined query
expect(error.message).toContain("Cannot read properties of undefined");
// The error now properly validates required parameters
expect(error.message).toContain("Missing required parameters");
}
});