const axios = require('axios');
async function debugGithubResponse() {
console.log('🔍 DEBUG: What does GitHub version actually return?');
try {
// Auth
const authResponse = await axios.post('http://localhost:3000/auth', {
username: 'david+saola@umbrellacost.com',
password: 'Dsamsung1!'
}, { headers: { 'Content-Type': 'application/json' } });
const token = authResponse.data.bearerToken;
console.log('✅ Authenticated');
// Test with different queries
const queries = [
'what is my total cost?',
'what is my total AWS cost?',
'show me all available accounts',
'what do you recommend for saving AWS costs?'
];
for (const query of queries) {
console.log(`\n📋 Testing: "${query}"`);
const response = await axios.post('http://localhost:3000/mcp', {
jsonrpc: '2.0',
id: Date.now(),
method: 'tools/call',
params: { name: 'get_costs', arguments: { query } }
}, {
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
});
if (response.data?.result?.content?.[0]?.text) {
const text = response.data.result.content[0].text;
console.log(`📏 Response length: ${text.length} characters`);
try {
const data = JSON.parse(text);
if (Array.isArray(data)) {
console.log(`📊 JSON array with ${data.length} items`);
const total = data.reduce((sum, item) => sum + (item.total_cost || 0), 0);
console.log(`💰 Total cost: $${total.toFixed(2)}`);
console.log(`📅 Date range: ${data[0]?.usage_date} to ${data[data.length-1]?.usage_date}`);
}
} catch (e) {
console.log('❌ Not JSON format');
}
} else {
console.log('❌ No response content');
}
await new Promise(resolve => setTimeout(resolve, 500));
}
} catch (error) {
console.error('❌ Error:', error.message);
}
}
debugGithubResponse().catch(console.error);