#!/usr/bin/env node
const { spawn } = require('child_process');
async function runAllQuestions() {
console.log('📋 ALL QUESTIONS TEST - UPDATED LIST');
console.log('═'.repeat(80));
const server = spawn('node', ['dist/index.js'], { stdio: ['pipe', 'pipe', 'pipe'] });
let messageId = 1;
let responses = new Map();
server.stdout.on('data', (data) => {
const lines = data.toString().split('\n').filter(l => l.trim());
lines.forEach(line => {
try {
const msg = JSON.parse(line);
if (msg.id) responses.set(msg.id, msg);
} catch(e) {}
});
});
server.stderr.on('data', (data) => {
const logMsg = data.toString().trim();
if (logMsg.includes('[AUTO-SELECT]')) {
console.log('🔧', logMsg);
}
});
await new Promise(r => setTimeout(r, 2000));
// Initialize
server.stdin.write(JSON.stringify({
jsonrpc: '2.0',
id: messageId++,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'all-questions-final', version: '1.0.0' }
}
}) + '\n');
await new Promise(r => setTimeout(r, 1000));
// Authenticate
const authId = messageId++;
server.stdin.write(JSON.stringify({
jsonrpc: '2.0',
id: authId,
method: 'tools/call',
params: {
name: 'authenticate_user',
arguments: {
username: 'david+saola@umbrellacost.com',
password: 'Dsamsung1!'
}
}
}) + '\n');
await new Promise(r => setTimeout(r, 4000));
// Updated questions from questions.test
const questions = [
{
q: 'what is my total cost?',
tool: 'api__invoices_caui',
args: {
startDate: '2025-08-11',
endDate: '2025-08-17',
groupBy: 'service',
periodGranLevel: 'day'
}
},
{
q: 'what is my total AWS cost?',
tool: 'api__invoices_caui',
args: {
startDate: '2025-08-11',
endDate: '2025-08-17',
groupBy: 'service',
periodGranLevel: 'day',
accountId: '932213950603'
}
},
{
q: 'what is my total GCP cost?',
tool: 'api__invoices_caui',
args: {
startDate: '2025-08-11',
endDate: '2025-08-17',
groupBy: 'service',
periodGranLevel: 'day',
accountId: 'Pileus-b39821'
}
},
{
q: 'what is my total Azure cost?',
tool: 'api__invoices_caui',
args: {
startDate: '2025-08-11',
endDate: '2025-08-17',
groupBy: 'service',
periodGranLevel: 'day',
accountId: 'azure-pileus-9322'
}
},
{
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'
}
},
{
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',
accountId: '932213950603'
}
},
{
q: 'show me all available accounts',
tool: 'api__users',
args: {}
},
{
q: 'what do you recommend to do for saving AWS costs?',
tool: 'api__recommendations_report',
args: {}
},
{
q: 'what are the potential savings per category?',
tool: 'api__recommendations_report',
args: {}
},
{
q: 'Is there any anomalies on AWS?',
tool: 'api__anomaly_detection',
args: {
startDate: '2025-08-11',
endDate: '2025-08-17'
}
}
];
let successCount = 0;
let failCount = 0;
// Test each question
for (let i = 0; i < questions.length; i++) {
const question = questions[i];
console.log(`\n${i + 1}/${questions.length}. "${question.q}"`);
console.log(` Tool: ${question.tool}`);
const questionId = messageId++;
server.stdin.write(JSON.stringify({
jsonrpc: '2.0',
id: questionId,
method: 'tools/call',
params: {
name: question.tool,
arguments: question.args
}
}) + '\n');
await new Promise(r => setTimeout(r, 8000));
const response = responses.get(questionId);
if (response && response.result && !response.error) {
const text = response.result.content[0].text;
// Extract key metrics for summary
let summary = [];
if (text.includes('account_id')) {
const accountMatch = text.match(/"account_id":\s*"([^"]+)"/);
if (accountMatch) summary.push(`Account: ${accountMatch[1]}`);
}
if (text.includes('Results:')) {
const resultsMatch = text.match(/Results:\*\* (\d+)/);
if (resultsMatch) summary.push(`${resultsMatch[1]} items`);
}
if (text.includes('$')) {
const totalMatch = text.match(/Total.*?\$([0-9,]+(?:\.[0-9]+)?)/);
if (totalMatch) summary.push(`Total: $${totalMatch[1]}`);
}
if (text.includes('recommendations')) {
const recMatch = text.match(/(\d+) recommendations/);
if (recMatch) summary.push(`${recMatch[1]} recommendations`);
}
console.log(` ✅ SUCCESS - ${summary.join(', ')}`);
successCount++;
} else {
console.log(' ❌ FAILED');
if (response && response.error) {
console.log(` Error: ${response.error.message}`);
}
failCount++;
}
}
console.log('\n' + '═'.repeat(80));
console.log('📊 FINAL QUESTION STATISTICS:');
console.log(`✅ Successful: ${successCount}/${questions.length} (${Math.round(successCount/questions.length*100)}%)`);
console.log(`❌ Failed: ${failCount}/${questions.length} (${Math.round(failCount/questions.length*100)}%)`);
if (successCount === questions.length) {
console.log('\n🎉 ALL QUESTIONS WORKING PERFECTLY!');
console.log('🚀 MCP server ready for Claude Desktop');
} else {
console.log('\n⚠️ Some questions need attention');
}
server.kill();
}
runAllQuestions().catch(console.error);