const axios = require('axios');
const SERVER_BASE = 'http://localhost:3000';
const SAOLA_CREDS = { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' };
async function checkExactMonth() {
console.log('📅 CHECKING EXACT MONTH AND DATE RANGE');
console.log('================================================================================');
try {
// Authenticate
const authResponse = await axios.post(`${SERVER_BASE}/auth`, SAOLA_CREDS, {
headers: { 'Content-Type': 'application/json' }
});
const bearerToken = authResponse.data.bearerToken;
// Test multiple specific months to see what data we get
const months = [
{ name: 'August 2025', start: '2025-08-01', end: '2025-08-31' },
{ name: 'July 2025', start: '2025-07-01', end: '2025-07-31' },
{ name: 'September 2025', start: '2025-09-01', end: '2025-09-30' },
{ name: 'Current Month (partial)', start: '2025-09-01', end: '2025-09-05' },
];
for (const month of months) {
console.log(`\n📅 TESTING: ${month.name} (${month.start} to ${month.end})`);
console.log('─'.repeat(60));
try {
const response = await axios.post(`${SERVER_BASE}/mcp`, {
jsonrpc: '2.0',
id: Date.now(),
method: 'tools/call',
params: {
name: 'get_costs',
arguments: {
startDate: month.start,
endDate: month.end,
periodGranLevel: 'month',
costType: ['cost', 'discount'],
isUnblended: true,
accountId: '932213950603'
}
}
}, {
headers: {
'Authorization': `Bearer ${bearerToken}`,
'Content-Type': 'application/json'
}
});
if (response.data?.result?.content?.[0]?.text) {
const data = JSON.parse(response.data.result.content[0].text);
if (Array.isArray(data) && data.length > 0) {
console.log(`✅ Data found for ${month.name}:`);
data.forEach((item) => {
console.log(` Account: ${item.account_id}`);
console.log(` API Period: ${item.usage_date}`);
console.log(` Cost: $${parseFloat(item.total_cost).toFixed(2)}`);
console.log(` Usage: ${item.total_usage_quantity}`);
});
} else {
console.log(`❌ No data for ${month.name}`);
}
} else {
console.log(`❌ API error for ${month.name}`);
}
} catch (error) {
console.log(`❌ Request failed for ${month.name}: ${error.message}`);
}
}
console.log('\n' + '🎯'.repeat(20));
console.log('SUMMARY: The $191,909.74 corresponds to which exact month above?');
console.log('🎯'.repeat(20));
} catch (error) {
console.error(`❌ Test failed: ${error.message}`);
}
}
checkExactMonth();