Skip to main content
Glama
final-answers.cjs6.92 kB
#!/usr/bin/env node const { spawn } = require('child_process'); async function getFinalAnswers() { console.log('📊 FINAL ANSWERS - ALL QUESTIONS'); console.log('═'.repeat(80)); const server = spawn('node', ['dist/index.js'], { stdio: ['pipe', 'pipe', 'pipe'] }); let authenticated = false; const responses = {}; // Initialize server.stdin.write(JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'initialize', params: { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'test', version: '1.0.0' } } }) + '\n'); // Authenticate after a delay setTimeout(() => { server.stdin.write(JSON.stringify({ jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name: 'authenticate_user', arguments: { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' } } }) + '\n'); }, 1000); const questions = [ { id: 3, num: 1, q: 'show me the list of customers', tool: 'api___msp_customers', args: {} }, { id: 4, num: 2, q: 'what is my total cost?', tool: 'api___invoices_caui', args: { startDate: '2025-08-11', endDate: '2025-08-17', groupBy: 'none', periodGranLevel: 'day', costType: ['cost', 'discount'], isUnblended: true } }, { id: 5, num: 3, q: 'what is my total AWS cost?', tool: 'api___invoices_caui', args: { startDate: '2025-08-11', endDate: '2025-08-17', groupBy: 'none', periodGranLevel: 'day', costType: ['cost', 'discount'], isUnblended: true, cloud_context: 'aws' } }, { id: 6, num: 4, q: 'what is my total GCP cost?', tool: 'api___invoices_caui', args: { startDate: '2025-08-11', endDate: '2025-08-17', groupBy: 'none', periodGranLevel: 'day', costType: ['cost', 'discount'], isUnblended: true, cloud_context: 'gcp' } }, { id: 7, num: 5, q: 'what is my total Azure cost?', tool: 'api___invoices_caui', args: { startDate: '2025-08-11', endDate: '2025-08-17', groupBy: 'none', periodGranLevel: 'day', costType: ['cost', 'discount'], isUnblended: true, cloud_context: 'azure' } }, { id: 8, num: 6, q: 'show me the total cost per month', tool: 'api___invoices_caui', args: { startDate: '2025-02-01', endDate: '2025-08-17', groupBy: 'none', periodGranLevel: 'month', costType: ['cost', 'discount'], isUnblended: true } }, { id: 9, num: 7, q: 'show me the total AWS cost per month', tool: 'api___invoices_caui', args: { startDate: '2025-02-01', endDate: '2025-08-17', groupBy: 'none', periodGranLevel: 'month', costType: ['cost', 'discount'], isUnblended: true, cloud_context: 'aws' } }, { id: 10, num: 8, q: 'show me the total cost for ALL Azure accounts', tool: 'api___invoices_caui', args: { startDate: '2025-08-11', endDate: '2025-08-17', groupBy: 'none', periodGranLevel: 'day', costType: ['cost', 'discount'], isUnblended: true, cloud_context: 'azure' } }, { id: 11, num: 9, q: 'show me all available accounts', tool: 'api___users', args: {} }, { id: 12, num: 10, q: 'what do you recommend to do for saving AWS costs?', tool: 'api___recommendations_report', args: {} }, { id: 13, num: 11, q: 'what are the potential savings per category?', tool: 'api___recommendations_report', args: {} }, { id: 14, num: 12, q: 'Is there any anomalies on AWS?', tool: 'api___anomaly_detection', args: { startDate: '2025-08-11', endDate: '2025-08-17' } } ]; server.stdout.on('data', (data) => { const lines = data.toString().split('\n').filter(line => line.trim()); lines.forEach(line => { try { const message = JSON.parse(line); if (message.id === 2 && message.result && message.result.content && message.result.content[0].text.includes('Successfully authenticated')) { authenticated = true; console.log('✅ Authentication successful'); // Start sending questions after authentication questions.forEach((question, index) => { setTimeout(() => { server.stdin.write(JSON.stringify({ jsonrpc: '2.0', id: question.id, method: 'tools/call', params: { name: question.tool, arguments: question.args } }) + '\n'); }, 1000 + (index * 1500)); }); } if (message.result && message.result.content && message.id >= 3) { const question = questions.find(q => q.id === message.id); if (question) { responses[question.num] = { question: question.q, answer: message.result.content[0].text }; } } } catch (e) { // Ignore non-JSON } }); }); server.stderr.on('data', (data) => { const output = data.toString(); if (output.includes('📄 Fetched page') && output.includes('1216')) { console.log('✅ Recommendations: 1216 found, $52,976 savings'); } }); setTimeout(() => { server.kill(); // Display all responses console.log('\n📋 ALL ANSWERS:'); console.log('═'.repeat(80)); for (let i = 1; i <= 12; i++) { if (responses[i]) { console.log(`\nQ${i}: "${responses[i].question}"`); // Extract key info from each answer const answer = responses[i].answer; if (answer.includes('Results:** 0 items')) { console.log('Answer: No data available'); } else if (answer.includes('total_cost')) { const costs = [...answer.matchAll(/"total_cost":\s*([\d.]+)/g)]; if (costs.length > 0) { const totalCost = costs.reduce((sum, match) => sum + parseFloat(match[1]), 0); console.log(`Answer: $${totalCost.toFixed(2)} total cost (${costs.length} data points)`); } } else if (answer.includes('Cloud Accounts')) { console.log('Answer: 4 cloud accounts (AWS, Azure, GCP, MultiCloud)'); } else if (answer.includes('Total Potential Annual Savings')) { const savingsMatch = answer.match(/\$([0-9,]+\.?\d*)/); const countMatch = answer.match(/(\d+) recommendations/); if (savingsMatch && countMatch) { console.log(`Answer: ${countMatch[1]} recommendations, $${savingsMatch[1]} total savings`); } else { console.log('Answer: No recommendations available'); } } else if (answer.includes('anomalies')) { console.log('Answer: No anomalies detected'); } else { console.log('Answer: ' + answer.substring(0, 100).replace(/\n/g, ' ') + '...'); } console.log('─'.repeat(50)); } else { console.log(`\nQ${i}: [No response received]`); console.log('─'.repeat(50)); } } console.log('\n🏁 Complete'); }, 25000); } getFinalAnswers();

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