// Final test to confirm tools work properly
import { spawn } from 'child_process';
const testCases = [
// Valid syllogism
{
name: "Syllogistic validation",
params: {
name: "logic-thinking",
arguments: {
system: "syllogistic",
operation: "validate",
input: "All men are mortal. Socrates is a man. Therefore, Socrates is mortal.",
format: "natural"
}
}
},
// Command test
{
name: "List fallacies command",
params: {
name: "logic-thinking",
arguments: {
command: {
type: "listFallacies"
}
}
}
}
];
async function runFinalTest() {
for (let i = 0; i < testCases.length; i++) {
const testCase = testCases[i];
console.log(`\n${'='.repeat(50)}`);
console.log(`Test ${i + 1}: ${testCase.name}`);
console.log(`${'='.repeat(50)}\n`);
await runTest(testCase);
// Wait between tests
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
function runTest(testCase) {
return new Promise((resolve) => {
const mcpServer = spawn('node', ['--max-old-space-size=4096', './dist/index.js'], {
cwd: process.cwd(),
stdio: ['pipe', 'pipe', 'pipe']
});
const request = {
jsonrpc: "2.0",
method: "tools/call",
params: testCase.params,
id: 1
};
let responseReceived = false;
mcpServer.stdout.on('data', (data) => {
const response = data.toString();
if (response.includes('"jsonrpc"')) {
try {
const parsed = JSON.parse(response);
console.log('Response:', JSON.stringify(parsed, null, 2));
responseReceived = true;
} catch (e) {
console.log('Raw response:', response);
}
}
});
setTimeout(() => {
console.log('Sending request:', JSON.stringify(request, null, 2));
mcpServer.stdin.write(JSON.stringify(request) + '\n');
// Wait a bit longer for response
setTimeout(() => {
if (!responseReceived) {
console.log('No response received! Check server logs.');
}
mcpServer.kill('SIGINT');
resolve();
}, 3000);
}, 500);
});
}
runFinalTest().catch(console.error);