Skip to main content
Glama

SAP OData to MCP Server

by Raistlin82
test-ui-routing.cjsโ€ข4.82 kB
#!/usr/bin/env node /** * UI Routing Test - Verifica il corretto routing delle richieste UI */ const { IntelligentToolRouter } = require('../dist/middleware/intelligent-tool-router.js'); console.log('๐Ÿงช Testing UI Routing Patterns...\n'); // Test cases specifici const testCases = [ { input: "Crea un form per visualizzare una lista di business partner da SAP", expectedTool: "sap-smart-query", expectedUiIntent: "ui-form-generator", description: "Form creation request (Italian)" }, { input: "Create a form for customer data", expectedTool: "sap-smart-query", expectedUiIntent: "ui-form-generator", description: "Form creation request (English)" }, { input: "Mostra una griglia con i dati dei prodotti", expectedTool: "sap-smart-query", expectedUiIntent: "ui-data-grid", description: "Data grid request (Italian)" }, { input: "Display a table for sales orders", expectedTool: "sap-smart-query", expectedUiIntent: "ui-data-grid", description: "Data grid request (English)" }, { input: "Mostrami solo i clienti tedeschi", expectedTool: "natural-query-builder", expectedUiIntent: undefined, description: "Regular data query (no UI intent)" } ]; // Initialize router const router = new IntelligentToolRouter(); // Test Results const results = []; console.log('๐ŸŽฏ Running Test Cases:\n'); testCases.forEach((testCase, index) => { console.log(`๐Ÿ“‹ Test ${index + 1}: ${testCase.description}`); console.log(` Input: "${testCase.input}"`); try { const result = router.analyzeRequest(testCase.input); const success = { tool: result.selectedTool === testCase.expectedTool, uiIntent: result.uiIntent === testCase.expectedUiIntent }; const overallSuccess = success.tool && (testCase.expectedUiIntent ? success.uiIntent : true); console.log(` โœ… Tool: ${result.selectedTool} ${success.tool ? 'โœ“' : 'โœ—'}`); if (testCase.expectedUiIntent) { console.log(` โœ… UI Intent: ${result.uiIntent || 'none'} ${success.uiIntent ? 'โœ“' : 'โœ—'}`); } console.log(` ๐Ÿ“Š Confidence: ${result.confidence}`); console.log(` ๐Ÿ’ญ Reason: ${result.reason}`); console.log(` ๐ŸŽฏ Overall: ${overallSuccess ? 'โœ… PASS' : 'โŒ FAIL'}\n`); results.push({ testCase: testCase.description, passed: overallSuccess, details: { expectedTool: testCase.expectedTool, actualTool: result.selectedTool, expectedUiIntent: testCase.expectedUiIntent, actualUiIntent: result.uiIntent, confidence: result.confidence, reason: result.reason } }); } catch (error) { console.log(` โŒ ERROR: ${error.message}\n`); results.push({ testCase: testCase.description, passed: false, details: { error: error.message } }); } }); // Summary console.log('='.repeat(60)); console.log('๐Ÿงช UI ROUTING TEST RESULTS SUMMARY'); console.log('='.repeat(60)); const passed = results.filter(r => r.passed).length; const total = results.length; const successRate = (passed / total) * 100; console.log(`\n๐Ÿ“Š Overall Results:`); console.log(` โœ… Passed: ${passed}`); console.log(` โŒ Failed: ${total - passed}`); console.log(` ๐Ÿ“ˆ Total: ${total}`); console.log(` ๐Ÿ’ฏ Success Rate: ${successRate.toFixed(1)}%`); if (total - passed > 0) { console.log(`\nโŒ Failed Tests:`); results .filter(r => !r.passed) .forEach(result => { console.log(` โ€ข ${result.testCase}`); if (result.details.error) { console.log(` Error: ${result.details.error}`); } else { console.log(` Expected: ${result.details.expectedTool}${result.details.expectedUiIntent ? ' โ†’ ' + result.details.expectedUiIntent : ''}`); console.log(` Actual: ${result.details.actualTool}${result.details.actualUiIntent ? ' โ†’ ' + result.details.actualUiIntent : ''}`); } }); } if (successRate >= 95) { console.log(`\n๐ŸŽ‰ EXCELLENT! UI routing is working perfectly.`); } else if (successRate >= 80) { console.log(`\nโœ… GOOD! UI routing is mostly functional with minor issues.`); } else { console.log(`\nโš ๏ธ WARNING! UI routing has significant issues that need attention.`); } console.log(`\n๐Ÿ”— Expected behavior: UI requests should route through sap-smart-query with uiIntent field.`); // Exit with appropriate code process.exit(total - passed === 0 ? 0 : 1);

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/Raistlin82/btp-sap-odata-to-mcp-server-optimized'

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