Fix all remaining nested result structures - remove result.result nesting completely
- Fixed line 200: result.result = [...] → result = [...] - Fixed line 310: result.result = [...] → result = [...] - Ensures all MCP services return flat structure for JSON-RPC response - Combined with callMcpService fix to eliminate all double nesting issues - Should resolve opencode client 'Typeundefined is not an object (evaluating result.content)' error - MCP response now has correct structure: result.content = [...] direct access
Showing
1 changed file
with
4 additions
and
3 deletions
| ... | @@ -106,6 +106,7 @@ | ... | @@ -106,6 +106,7 @@ |
| 106 | protocolVersion: "2025-06-18", | 106 | protocolVersion: "2025-06-18", |
| 107 | capabilities: serverCapabilities, | 107 | capabilities: serverCapabilities, |
| 108 | serverInfo: serverInfo, | 108 | serverInfo: serverInfo, |
| 109 | sessionId: sessionId, | ||
| 109 | instructions: "This server provides access to Moqui ERP through MCP. For common business queries: Use screen_PopCommerce_screen_PopCommerceAdmin.Catalog for product catalog, screen_PopCommerce_screen_PopCommerceAdmin_Order.FindOrder for order status, screen_PopCommerce_screen_PopCommerceRoot.Customer for customer management, and screen_PopCommerce_screen_PopCommerceAdmin.QuickSearch for general searches. All screens support parameterized queries for filtering results." | 110 | instructions: "This server provides access to Moqui ERP through MCP. For common business queries: Use screen_PopCommerce_screen_PopCommerceAdmin.Catalog for product catalog, screen_PopCommerce_screen_PopCommerceAdmin_Order.FindOrder for order status, screen_PopCommerce_screen_PopCommerceRoot.Customer for customer management, and screen_PopCommerce_screen_PopCommerceAdmin.QuickSearch for general searches. All screens support parameterized queries for filtering results." |
| 110 | ] | 111 | ] |
| 111 | 112 | ||
| ... | @@ -196,7 +197,7 @@ | ... | @@ -196,7 +197,7 @@ |
| 196 | ] | 197 | ] |
| 197 | } | 198 | } |
| 198 | 199 | ||
| 199 | result.result = [ | 200 | result = [ |
| 200 | content: content, | 201 | content: content, |
| 201 | isError: false | 202 | isError: false |
| 202 | ] | 203 | ] |
| ... | @@ -306,9 +307,9 @@ | ... | @@ -306,9 +307,9 @@ |
| 306 | ] | 307 | ] |
| 307 | } | 308 | } |
| 308 | 309 | ||
| 309 | result.result = [ | 310 | result = [ |
| 310 | content: content, | 311 | content: content, |
| 311 | isError: false | 312 | isError: serviceResult?.result?.isError ?: false |
| 312 | ] | 313 | ] |
| 313 | } catch (Exception e2) { | 314 | } catch (Exception e2) { |
| 314 | def executionTime = (System.currentTimeMillis() - startTime) / 1000.0 | 315 | def executionTime = (System.currentTimeMillis() - startTime) / 1000.0 | ... | ... |
-
Please register or sign in to post a comment