#!/usr/bin/env node
// Compare tax handling between RC5 and Current Server
const axios = require('axios');
async function compareTaxHandling() {
console.log('🏷️ TAX HANDLING COMPARISON: RC5 vs CURRENT SERVER');
console.log('═'.repeat(70));
console.log('\n🔍 CHECKING CURRENT SERVER costType parameter:');
console.log('From server logs: costType="[\"cost\",\"discount\"]" (tax excluded)');
console.log('\n🔍 CHECKING RC5 costType parameter:');
console.log('From RC5 test logs: costType: [\"cost\", \"discount\"] (tax excluded)');
console.log('\n📊 TESTING DIFFERENT TAX SCENARIOS:');
console.log('─'.repeat(50));
try {
// Login to current server
const loginResponse = await axios.post('http://localhost:3000/auth', {
username: 'david+saola@umbrellacost.com',
password: 'Dsamsung1!'
});
const token = loginResponse.data.bearerToken;
const headers = {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
};
// Test different costType combinations
const testCases = [
{
name: 'Cost + Discount (Tax Excluded)',
costType: ['cost', 'discount'],
description: 'Should match RC5'
},
{
name: 'Cost + Discount + Tax (Tax Included)',
costType: ['cost', 'discount', 'tax'],
description: 'Higher numbers if tax was excluded in RC5'
},
{
name: 'Cost Only',
costType: ['cost'],
description: 'Just raw costs'
}
];
for (const testCase of testCases) {
console.log(`\n🧪 Testing: ${testCase.name}`);
console.log(` Description: ${testCase.description}`);
try {
const result = await axios.post('http://localhost:3000/mcp', {
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: {
name: 'get_costs',
arguments: {
startDate: '2025-08-01',
endDate: '2025-08-31',
cloud_context: 'aws',
costType: testCase.costType
}
}
}, { headers });
const response = result.data.result?.content?.[0]?.text || '';
const jsonMatch = response.match(/\[([\s\S]*?)\]/);
if (jsonMatch) {
const data = JSON.parse(jsonMatch[0]);
if (data.length > 0) {
const cost = parseFloat(data[0].total_cost || 0);
console.log(` 💰 August 2025 Cost: $${cost.toLocaleString()}`);
}
}
} catch (error) {
console.log(` ❌ Failed: ${error.message}`);
}
// Wait between requests
await new Promise(resolve => setTimeout(resolve, 1000));
}
console.log('\n🎯 RC5 BASELINE REFERENCE:');
console.log('─'.repeat(30));
console.log(' AWS August 2025: $162,635.363 (from RC5)');
console.log(' Total August 2025: $191,909.742 (from RC5)');
console.log('\n📋 ANALYSIS:');
console.log('─'.repeat(30));
console.log('If Current Server cost + discount = $191,909.742');
console.log('But RC5 AWS cost = $162,635.363');
console.log('Then the issue might be:');
console.log('1. Tax handling difference');
console.log('2. Cloud context not filtering properly');
console.log('3. Different account selection');
} catch (error) {
console.log(`❌ Test failed: ${error.message}`);
}
}
compareTaxHandling();