Skip to main content
Glama
check-answers.cjsβ€’4.58 kB
#!/usr/bin/env node // Check actual answers by testing the API client directly for saola account const { UmbrellaApiClient } = require('./dist/api-client.js'); async function checkAnswers() { console.log(`πŸ” CHECKING ACTUAL ANSWERS FOR QUESTIONS.TEST`); console.log(`πŸ‘€ Account: saola (david+saola@umbrellacost.com)`); console.log('═'.repeat(80)); try { // Create API client and authenticate const apiClient = new UmbrellaApiClient('https://api.umbrellacost.io/api/v1'); console.log('πŸ” Authenticating saola account...'); const authResult = await apiClient.authenticate({ username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' }); if (!authResult.success) { throw new Error(`Authentication failed: ${authResult.error}`); } console.log('βœ… Authentication successful'); // Test each question's corresponding API call const tests = [ { q: "what is my total cost?", test: async () => { const result = await apiClient.makeRequest('/invoices/caui', { startDate: '2025-08-11', endDate: '2025-08-17', groupBy: 'service', periodGranLevel: 'day', costType: ['cost', 'discount'], isUnblended: true, accountId: '532523076083' }); return result; } }, { q: "show me all available accounts", test: async () => { const result = await apiClient.makeRequest('/users', {}); return result; } }, { q: "what do you recommend to do for saving AWS costs?", test: async () => { const result = await apiClient.getRecommendations({}); return result; } }, { q: "Is there any anomalies on AWS?", test: async () => { const result = await apiClient.makeRequest('/anomaly-detection', { startDate: '2025-08-11', endDate: '2025-08-17' }); return result; } } ]; for (let i = 0; i < tests.length; i++) { const test = tests[i]; console.log(`\nπŸ“ Q${i + 1}: "${test.q}"`); try { const result = await test.test(); if (result.success && result.data) { // Extract meaningful answers if (test.q.includes('total cost')) { if (Array.isArray(result.data)) { const totalCost = result.data.reduce((sum, item) => sum + (item.cost || 0), 0); console.log(`πŸ€– ANSWER: Total cost $${totalCost.toFixed(2)} across ${result.data.length} services`); } else { console.log(`πŸ€– ANSWER: Cost data structure:`, typeof result.data); } } else if (test.q.includes('available accounts')) { if (Array.isArray(result.data)) { console.log(`πŸ€– ANSWER: ${result.data.length} accounts available`); } else { console.log(`πŸ€– ANSWER: Account data available`); } } else if (test.q.includes('recommend')) { if (Array.isArray(result.data)) { const totalSavings = result.data.reduce((sum, rec) => sum + (rec.potentialSavings || rec.annualSavings || 0), 0); console.log(`πŸ€– ANSWER: ${result.data.length} recommendations with $${totalSavings.toFixed(2)} potential annual savings`); } else if (result.total_potential_savings) { console.log(`πŸ€– ANSWER: Recommendations available with $${result.total_potential_savings} potential savings`); } else { console.log(`πŸ€– ANSWER: Recommendations data available`); } } else if (test.q.includes('anomalies')) { if (Array.isArray(result.data)) { const openAnomalies = result.data.filter(a => a.status !== 'closed').length; console.log(`πŸ€– ANSWER: ${openAnomalies} open anomalies found`); } else { console.log(`πŸ€– ANSWER: Anomaly data available`); } } console.log(`βœ… Success`); } else { console.log(`❌ API Error: ${result.error || 'Unknown error'}`); } } catch (error) { console.log(`❌ Test Error: ${error.message}`); } } console.log('\n🏁 ANSWER CHECK COMPLETE'); } catch (error) { console.error(`❌ Answer check failed:`, error.message); } } checkAnswers().catch(console.error);

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