#!/usr/bin/env node
// Comprehensive MCP Time Server Live Testing
// This script tests all 8 tools through actual MCP calls
async function runTests() {
console.log('🧪 MCP Time Server Live Testing\n');
const tests = [];
let passed = 0;
let failed = 0;
// Test helper
function test(name, condition, actual, expected) {
if (condition) {
console.log(`✅ ${name}`);
passed++;
} else {
console.log(`❌ ${name}`);
console.log(` Expected: ${expected}`);
console.log(` Actual: ${actual}`);
failed++;
}
tests.push({ name, passed: condition });
}
console.log('1️⃣ Testing get_current_time\n');
// Test 1.1: Default (system timezone)
console.log('Test 1.1: System timezone default');
// MCP call would go here - results shown below
// Test 1.2: Specific timezone
console.log('Test 1.2: UTC timezone');
// MCP call would go here
// Test 1.3: Custom format
console.log('Test 1.3: Custom format');
// MCP call would go here
console.log('\n2️⃣ Testing convert_timezone\n');
// Test 2.1: Basic conversion
console.log('Test 2.1: UTC to EST conversion');
// MCP call would go here
// Test 2.2: Complex conversion
console.log('Test 2.2: Sydney to London');
// MCP call would go here
console.log('\n3️⃣ Testing add_time\n');
// Test 3.1: Add days
console.log('Test 3.1: Add 5 days');
// MCP call would go here
// Test 3.2: Add hours across DST
console.log('Test 3.2: Add hours');
// MCP call would go here
console.log('\n4️⃣ Testing subtract_time\n');
// Test 4.1: Subtract months
console.log('Test 4.1: Subtract 3 months');
// MCP call would go here
console.log('\n5️⃣ Testing calculate_duration\n');
// Test 5.1: Duration in days
console.log('Test 5.1: Duration between dates');
// MCP call would go here
console.log('\n6️⃣ Testing get_business_days\n');
// Test 6.1: Business days calculation
console.log('Test 6.1: Business days in a week');
// MCP call would go here
// Test 6.2: With holidays
console.log('Test 6.2: Business days with holidays');
// MCP call would go here
console.log('\n7️⃣ Testing next_occurrence\n');
// Test 7.1: Next Monday
console.log('Test 7.1: Next Monday');
// MCP call would go here
// Test 7.2: Next monthly occurrence
console.log('Test 7.2: Next 15th of month');
// MCP call would go here
console.log('\n8️⃣ Testing format_time\n');
// Test 8.1: Relative format
console.log('Test 8.1: Relative time');
// MCP call would go here
// Test 8.2: Calendar format
console.log('Test 8.2: Calendar format');
// MCP call would go here
console.log('\n9️⃣ Testing Error Handling\n');
// Test 9.1: Invalid timezone
console.log('Test 9.1: Invalid timezone error');
// MCP call would go here
// Test 9.2: Invalid date
console.log('Test 9.2: Invalid date error');
// MCP call would go here
// Summary
console.log('\n📊 Test Summary');
console.log('─'.repeat(40));
console.log(`Total Tests: ${passed + failed}`);
console.log(`Passed: ${passed} ✅`);
console.log(`Failed: ${failed} ❌`);
console.log(`Success Rate: ${((passed / (passed + failed)) * 100).toFixed(1)}%`);
return { passed, failed };
}
// Note: This is a template. Actual MCP calls would be made through Claude
console.log('This is a test template. Run actual tests through Claude MCP calls.');
console.log('\nTo execute full test suite:');
console.log('1. Each test case needs to be run through actual MCP tool calls');
console.log('2. Results should be validated against expected values');
console.log('3. Error cases should properly return error responses');