test-photosynthesis-7th.js•1.87 kB
#!/usr/bin/env node
import { spawn } from 'child_process';
import { join } from 'path';
const PROJECT_ROOT = '/Users/ricardokawasaki/Desktop/euconquisto-composer-mcp-poc';
async function testPhotosynthesisLesson() {
console.log('🧪 Testing Photosynthesis Lesson Creation for 7th Grade...\n');
const mcpProcess = spawn('node', [
join(PROJECT_ROOT, 'dist/browser-automation-api-direct-save-v4.0.3.js')
], {
stdio: ['pipe', 'pipe', 'pipe']
});
// MCP request for photosynthesis lesson
const request = {
jsonrpc: "2.0",
id: 1,
method: "tools/call",
params: {
name: "create_educational_composition",
arguments: {
prompt: "Criar uma aula sobre fotossíntese",
subject: "Ciências",
gradeLevel: "7º ano"
}
}
};
console.log('📝 Sending request:', JSON.stringify(request, null, 2));
console.log('\n🔄 Processing...\n');
// Send the request
mcpProcess.stdin.write(JSON.stringify(request) + '\n');
// Handle response
let responseData = '';
mcpProcess.stdout.on('data', (data) => {
responseData += data.toString();
});
mcpProcess.stderr.on('data', (data) => {
console.log('❌ Error:', data.toString());
});
mcpProcess.on('close', (code) => {
if (responseData.trim()) {
try {
const response = JSON.parse(responseData);
console.log('✅ Response received:');
console.log(JSON.stringify(response, null, 2));
} catch (e) {
console.log('📄 Raw response:');
console.log(responseData);
}
}
console.log(`\n🏁 Process completed with code: ${code}`);
});
// Keep process alive for browser automation
setTimeout(() => {
console.log('\n⏰ Test completed - browser should be running with the lesson!');
}, 10000);
}
testPhotosynthesisLesson().catch(console.error);