Skip to main content
Glama
MOIDVK_JS_TOOLS_DESTRUCTURING_ERROR.md2.36 kB
# Moidvk JavaScript Tools Destructuring Error - RESOLVED ## Issue Description Multiple moidvk JavaScript analysis tools were failing with "Right side of assignment cannot be destructured" errors: - `moidvk_js_test_analyzer` - `moidvk_bundle_size_analyzer` - `moidvk_js_performance_analyzer` ## Error Pattern ``` ❌ Analysis failed: Right side of assignment cannot be destructured ``` ## Root Cause Analysis **RESOLVED**: The issue was NOT with JavaScript parsing or destructuring syntax. The problem was in the **MCP server integration layer**. ### Investigation Results 1. **Parser Dependencies**: @babel/parser v7.28.0 - up to date and working correctly 2. **Tool Functions**: All individual tool handlers work perfectly when called directly 3. **JavaScript Parsing**: All destructuring patterns parse correctly with Babel 4. **MCP Integration**: **BUG FOUND** - Server was passing arguments incorrectly ### The Actual Bug In `server.js` line 327, the MCP server was calling: ```javascript const result = await handler(args || {}); ``` But the handlers expect: ```javascript const result = await handler({ params: args || {} }); ``` ## Solution Implemented **Fixed in server.js line 327:** ```javascript // BEFORE (broken) const result = await handler(args || {}); // AFTER (fixed) const result = await handler({ params: args || {} }); ``` ## Verification ✅ All tools now work correctly when called through MCP server ✅ Direct function calls work perfectly ✅ All destructuring patterns parse correctly ✅ Bundle analysis works (with expected bun build warnings) ## Status - **Severity**: High - Multiple core JS tools affected - **Impact**: JavaScript/TypeScript analysis capabilities restored - **Resolution**: Complete - MCP server parameter passing fixed - **Date Resolved**: 2025-01-23 ## Lessons Learned 1. Always test MCP integration layer separately from tool logic 2. Parameter passing between MCP client/server needs careful validation 3. Error messages can be misleading - "destructuring" error was actually parameter structure issue 4. Multiple running server instances can mask fixes - always restart servers after changes ## Files Modified - `server.js` - Fixed MCP handler parameter passing - `test/debug-destructuring-issue.js` - Created comprehensive test cases - `test/test-mcp-fix.js` - Created MCP integration test

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/moikas-code/moidvk'

If you have feedback or need assistance with the MCP directory API, please join our Discord server