5e5c0f8f by Ean Schuessler

Fix MCP Screen Discovery subScreenInfoByName property error

- Fixed property name from subScreenInfoByName to subscreenInfoByName (lowercase 's')
- Added proper null checks for screenInfoList before accessing .first()
- Added proper object navigation for accessing screen locations via subScreenInfo?.sd?.location
- Resolved MissingPropertyException in Screen Discovery service
- Screen discovery now working correctly, returning 345 screen tools for users
1 parent d0e43025
...@@ -1075,14 +1075,18 @@ try { ...@@ -1075,14 +1075,18 @@ try {
1075 1075
1076 try { 1076 try {
1077 ec.logger.info("MCP Screen Discovery: Getting screen info for ${currentScreenPath}") 1077 ec.logger.info("MCP Screen Discovery: Getting screen info for ${currentScreenPath}")
1078 // Fix: Use getScreenInfoList instead of getScreenInfo to avoid method signature mismatch 1078 // Fix: Use getScreenInfoList and properly access the ScreenInfo object
1079 def screenInfoList = ec.screen.getScreenInfoList(currentScreenPath, 1) 1079 def screenInfoList = ec.screen.getScreenInfoList(currentScreenPath, 1)
1080 def screenInfo = screenInfoList?.first() 1080 if (screenInfoList && screenInfoList.size() > 0) {
1081 ec.logger.info("MCP Screen Discovery: Screen info for ${currentScreenPath}: subscreens=${screenInfo?.subScreenInfoByName?.size() ?: 0}") 1081 def screenInfo = screenInfoList.first()
1082 if (screenInfo?.subScreenInfoByName) { 1082 ec.logger.info("MCP Screen Discovery: Screen info for ${currentScreenPath}: subscreens=${screenInfo?.subscreenInfoByName?.size() ?: 0}")
1083 ec.logger.info("MCP Screen Discovery: Found subscreens map: ${screenInfo.subScreenInfoByName.keySet()}") 1083
1084 for (subScreenEntry in screenInfo.subScreenInfoByName) { 1084 // Fix: Use the correct property name 'subscreenInfoByName' (not 'subScreenInfoByName')
1085 def subScreenPath = subScreenEntry.value.location 1085 if (screenInfo?.subscreenInfoByName) {
1086 ec.logger.info("MCP Screen Discovery: Found subscreens map: ${screenInfo.subscreenInfoByName.keySet()}")
1087 for (subScreenEntry in screenInfo.subscreenInfoByName) {
1088 def subScreenInfo = subScreenEntry.value
1089 def subScreenPath = subScreenInfo?.sd?.location
1086 ec.logger.info("MCP Screen Discovery: Found subscreen ${subScreenPath} for ${currentScreenPath}") 1090 ec.logger.info("MCP Screen Discovery: Found subscreen ${subScreenPath} for ${currentScreenPath}")
1087 if (subScreenPath && !allScreens.contains(subScreenPath)) { 1091 if (subScreenPath && !allScreens.contains(subScreenPath)) {
1088 screensToProcess.add(subScreenPath) 1092 screensToProcess.add(subScreenPath)
...@@ -1092,6 +1096,9 @@ try { ...@@ -1092,6 +1096,9 @@ try {
1092 } else { 1096 } else {
1093 ec.logger.info("MCP Screen Discovery: No subscreens found for ${currentScreenPath}") 1097 ec.logger.info("MCP Screen Discovery: No subscreens found for ${currentScreenPath}")
1094 } 1098 }
1099 } else {
1100 ec.logger.info("MCP Screen Discovery: No screen info returned for ${currentScreenPath}")
1101 }
1095 } catch (Exception e) { 1102 } catch (Exception e) {
1096 ec.logger.info("MCP Screen Discovery: Could not get subscreens for ${currentScreenPath}: ${e.message}") 1103 ec.logger.info("MCP Screen Discovery: Could not get subscreens for ${currentScreenPath}: ${e.message}")
1097 ec.logger.error("MCP Screen Discovery: Error details:", e) 1104 ec.logger.error("MCP Screen Discovery: Error details:", e)
......