Skip to main content
Glama
detailed-answers-test.cjsβ€’8.88 kB
#!/usr/bin/env node // Detailed Answers Test - Show full content of all responses const { spawn } = require('child_process'); const { EventEmitter } = require('events'); class DetailedAnswersTest extends EventEmitter { constructor() { super(); this.serverProcess = null; this.messageId = 1; this.pendingRequests = new Map(); } async startServer() { console.log('πŸ”§ Starting MCP server for detailed answers test...'); this.serverProcess = spawn('node', ['dist/index.js'], { stdio: ['pipe', 'pipe', 'pipe'] }); this.serverProcess.stdout.on('data', (data) => { const lines = data.toString().split('\n').filter(line => line.trim()); lines.forEach(line => { try { const message = JSON.parse(line); this.handleMessage(message); } catch (e) {} }); }); this.serverProcess.stderr.on('data', (data) => { // Suppress server logs for clean output }); await new Promise(resolve => setTimeout(resolve, 2000)); console.log('βœ… MCP server ready for detailed testing'); } handleMessage(message) { if (message.id && this.pendingRequests.has(message.id)) { const resolve = this.pendingRequests.get(message.id); this.pendingRequests.delete(message.id); resolve(message); } } async sendRequest(method, params) { const id = this.messageId++; const request = { jsonrpc: '2.0', id, method, params }; return new Promise((resolve, reject) => { this.pendingRequests.set(id, resolve); this.serverProcess.stdin.write(JSON.stringify(request) + '\n'); setTimeout(() => { if (this.pendingRequests.has(id)) { this.pendingRequests.delete(id); reject(new Error('Timeout')); } }, 20000); }); } async initialize() { await this.sendRequest('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'detailed-answers-tester', version: '1.0.0' } }); } async authenticate() { const authResult = await this.sendRequest('tools/call', { name: 'authenticate_user', arguments: { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' } }); return authResult.result.content[0].text.includes('Successfully authenticated'); } async testAllQuestionsDetailed() { const questions = [ { id: 'Q1', name: 'list_endpoints', args: {}, title: 'Available API Endpoints', description: 'Shows all available Umbrella Cost API endpoints' }, { id: 'Q2', name: 'api___msp_customers', args: {}, title: 'MSP Customer List', description: 'List of MSP customers (business entities)' }, { id: 'Q3', name: 'api___user_management_accounts', args: {}, title: 'All Available Accounts', description: 'Complete inventory of cloud accounts' }, { id: 'Q4', name: 'api___invoices_caui', args: { startDate: '2025-08-01', endDate: '2025-08-18', groupBy: 'service', periodGranLevel: 'day' }, title: 'Current Month Daily Costs', description: 'Daily cost breakdown for current month' }, { id: 'Q5', name: 'api___invoices_caui', args: { startDate: '2025-06-01', endDate: '2025-08-18', groupBy: 'none', periodGranLevel: 'month', cloud_context: 'aws' }, title: 'AWS Monthly Cost Trends', description: 'AWS costs aggregated by month (verified against UI)' }, { id: 'Q6', name: 'api___invoices_caui', args: { startDate: '2025-03-01', endDate: '2025-08-18', groupBy: 'none', periodGranLevel: 'month', isUnblended: 'false', // Testing amortized costs cloud_context: 'aws' }, title: 'AWS Amortized Costs (Last 6 Months)', description: 'AWS amortized costs including RI and savings plan benefits' }, { id: 'Q7', name: 'api___invoices_caui', args: { startDate: '2025-08-01', endDate: '2025-08-18', groupBy: 'service', cloud_context: 'aws' }, title: 'AWS Service Breakdown', description: 'AWS costs broken down by service' }, { id: 'Q8', name: 'api___apiv2recommendationslist', args: {}, title: 'Cost Optimization Recommendations', description: 'AI-powered cost saving recommendations' }, { id: 'Q9', name: 'api___anomaly_detection', args: { startDate: '2025-08-01', endDate: '2025-08-18' }, title: 'Cost Anomaly Detection', description: 'Detection of unusual spending patterns' }, { id: 'Q10', name: 'api___invoices_service_names_distinct', args: { limit: 20 }, title: 'Available Services (Top 20)', description: 'Most commonly used cloud services' } ]; console.log('\\nπŸ” DETAILED ANSWERS TEST - FULL CONTENT'); console.log('═'.repeat(100)); console.log('Testing all key questions with complete response details'); console.log('═'.repeat(100)); for (const question of questions) { try { console.log(`\\n${'β–ˆ'.repeat(100)}`); console.log(`πŸ“‹ ${question.id}: ${question.title}`); console.log(`πŸ’‘ ${question.description}`); console.log(`πŸ”§ Tool: ${question.name}`); console.log(`πŸ“ Args: ${JSON.stringify(question.args, null, 2)}`); console.log(`${'β–ˆ'.repeat(100)}`); const result = await this.sendRequest('tools/call', { name: question.name, arguments: question.args }); const response = result.result.content[0].text; console.log('\\nπŸ€– FULL DETAILED RESPONSE:'); console.log('─'.repeat(80)); console.log(response); console.log('─'.repeat(80)); // Extract key metrics from response const itemsMatch = response.match(/\\*\\*Results:\\*\\* (\\d+) items?/); const totalMatch = response.match(/\\$([\\d,]+\\.\\d{2})/); const savingsMatch = response.match(/\\$([\\d,]+\\.\\d{2}) annual savings/); const accountsMatch = response.match(/(\\d+) accounts?/); console.log('\\nπŸ“Š KEY METRICS EXTRACTED:'); if (itemsMatch) console.log(` πŸ“ˆ Items: ${itemsMatch[1]}`); if (totalMatch) console.log(` πŸ’° Cost: $${totalMatch[1]}`); if (savingsMatch) console.log(` πŸ’‘ Savings: $${savingsMatch[1]} annually`); if (accountsMatch) console.log(` 🏒 Accounts: ${accountsMatch[1]}`); const responseLength = response.length; console.log(` πŸ“ Response Length: ${responseLength} characters`); if (response.includes('❌') || response.includes('Error')) { console.log(' ⚠️ Status: Contains error or limitation indicators'); } else if (responseLength > 500) { console.log(' βœ… Status: Comprehensive successful response'); } else { console.log(' βœ… Status: Successful response'); } // Brief pause between questions await new Promise(resolve => setTimeout(resolve, 1000)); } catch (error) { console.log(`❌ ${question.id} FAILED: ${error.message}`); } } console.log('\\nπŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰'); console.log('🏁 DETAILED ANSWERS TEST COMPLETE'); console.log('All questions tested with full response details shown'); console.log('πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰'); } async disconnect() { if (this.serverProcess) { this.serverProcess.kill(); } } } async function runDetailedAnswersTest() { console.log('πŸ“‹ DETAILED ANSWERS TEST'); console.log('Showing complete response content for all questions'); console.log('═'.repeat(100)); const tester = new DetailedAnswersTest(); try { await tester.startServer(); await tester.initialize(); if (await tester.authenticate()) { console.log('βœ… Authentication successful - proceeding with detailed test'); await tester.testAllQuestionsDetailed(); } else { console.log('❌ Authentication failed'); } } catch (error) { console.error('❌ Test failed:', error.message); } finally { await tester.disconnect(); } } runDetailedAnswersTest();

Latest Blog Posts

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/daviddraiumbrella/invoice-monitoring'

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