Skip to main content
Glama
verify-mcp-fix.jsโ€ข2.59 kB
#!/usr/bin/env bun /** * Verify that MCP handlers work with both parameter formats */ import { handleCodePractices } from '../lib/tools/code-practices.js'; import { handleCodeFormatter } from '../lib/tools/code-formatter.js'; import { handleSafetyChecker } from '../lib/tools/safety-checker.js'; async function testHandlers() { console.log('๐Ÿงช Testing MCP handler parameter fix...\n'); const testCode = ` const test = () => { console.log("Testing"); var unused = 5; }`; // Test 1: Direct args format (legacy) console.log('๐Ÿ“ Test 1: Direct args format'); try { const result1 = await handleCodePractices({ code: testCode, filename: 'test.js', limit: 5 }); console.log('โœ… handleCodePractices (direct args): SUCCESS'); } catch (error) { console.log('โŒ handleCodePractices (direct args): FAILED -', error.message); } // Test 2: Params wrapper format (MCP protocol) console.log('\n๐Ÿ“ Test 2: Params wrapper format'); try { const result2 = await handleCodePractices({ params: { code: testCode, filename: 'test.js', limit: 5 } }); console.log('โœ… handleCodePractices (params wrapper): SUCCESS'); } catch (error) { console.log('โŒ handleCodePractices (params wrapper): FAILED -', error.message); } // Test 3: Code formatter console.log('\n๐Ÿ“ Test 3: Code formatter with both formats'); try { const result3a = await handleCodeFormatter({ code: 'const x=1;console.log(x);', filename: 'test.js' }); console.log('โœ… handleCodeFormatter (direct args): SUCCESS'); const result3b = await handleCodeFormatter({ params: { code: 'const x=1;console.log(x);', filename: 'test.js' } }); console.log('โœ… handleCodeFormatter (params wrapper): SUCCESS'); } catch (error) { console.log('โŒ handleCodeFormatter: FAILED -', error.message); } // Test 4: Safety checker console.log('\n๐Ÿ“ Test 4: Safety checker with both formats'); try { const result4a = await handleSafetyChecker({ code: testCode, filename: 'test.js' }); console.log('โœ… handleSafetyChecker (direct args): SUCCESS'); const result4b = await handleSafetyChecker({ params: { code: testCode, filename: 'test.js' } }); console.log('โœ… handleSafetyChecker (params wrapper): SUCCESS'); } catch (error) { console.log('โŒ handleSafetyChecker: FAILED -', error.message); } console.log('\nโœจ All tests completed!'); } testHandlers().catch(console.error);

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