Skip to main content
Glama

MCP Self-Learning Server

test-claudio-integration.js•6.89 kB
#!/usr/bin/env node /** * Test script for Claudio Integration */ import { ClaudioMCPLearningTools } from './integrations/claudio-mcp-tools.js'; async function testClaudioIntegration() { console.log('šŸ¤– Testing Claudio Integration...\n'); const tools = new ClaudioMCPLearningTools(); try { // Test initialization console.log('1. Testing initialization...'); await tools.initialize(); console.log(' āœ… Claudio MCP Learning Tools initialized\n'); // Test tool definitions console.log('2. Testing tool definitions...'); const toolDefinitions = tools.getToolDefinitions(); console.log(` āœ… Found ${toolDefinitions.length} MCP tools:`); toolDefinitions.forEach((tool, index) => { console.log(` ${index + 1}. ${tool.name} - ${tool.description.substring(0, 50)}...`); }); console.log(); // Test learn_from_interaction tool console.log('3. Testing learn_from_interaction...'); const interactionArgs = { agent_id: 'test-agent', workflow_id: 'test-workflow-001', input: 'Create a new React component', output: 'Created HelloWorld component with TypeScript support', success: true, duration: 1500, metadata: { tool_used: 'create_component', language: 'typescript', framework: 'react' } }; const interactionResult = await tools.handleToolCall('learn_from_interaction', interactionArgs); console.log(` āœ… Pattern learned: ${interactionResult.pattern_id?.substring(0, 8)}...`); console.log(` 🧠 Learning impact: ${interactionResult.learning_impact || 'positive'}`); console.log(` šŸ’” Recommendations: ${interactionResult.recommendations?.length || 0}\n`); // Test get_learning_insights tool console.log('4. Testing get_learning_insights...'); const insightsResult = await tools.handleToolCall('get_learning_insights', { workflow_id: 'test-workflow-001' }); console.log(` āœ… Insights retrieved: ${insightsResult.success}`); console.log(` šŸ“Š Total patterns: ${insightsResult.summary?.total_patterns || 0}`); console.log(` šŸ¤– Claudio interactions: ${insightsResult.summary?.claudio_interactions || 0}`); console.log(` ⚔ Workflow efficiency: ${insightsResult.summary?.workflow_efficiency || 0}\n`); // Test optimize_workflow tool console.log('5. Testing optimize_workflow...'); const optimizeArgs = { workflow_id: 'test-workflow-001', involved_agents: ['test-agent', 'code-generator', 'file-manager'], current_step: 'component_creation', performance: { averageTime: 2000, successRate: 0.95, errorRate: 0.05 } }; const optimizeResult = await tools.handleToolCall('optimize_workflow', optimizeArgs); console.log(` āœ… Optimizations generated: ${optimizeResult.success}`); console.log(` šŸŽÆ Optimization count: ${optimizeResult.optimizations?.length || 0}`); console.log(` šŸ“ˆ Confidence: ${optimizeResult.confidence || 'N/A'}`); if (optimizeResult.implementation_guide) { console.log(` šŸ“‹ Implementation priority: ${optimizeResult.implementation_guide.priority?.length || 0} items`); } console.log(); // Test predict_next_action tool console.log('6. Testing predict_next_action...'); const predictArgs = { current_agent: 'test-agent', workflow_state: { step: 'component_created', files_modified: ['HelloWorld.tsx', 'index.ts'], next_possible_actions: ['add_styles', 'add_tests', 'update_exports'] }, user_intent: 'create_complete_component', available_agents: [ { id: 'style-generator', capabilities: ['css', 'scss', 'styled-components'] }, { id: 'test-generator', capabilities: ['jest', 'testing-library', 'cypress'] } ] }; const predictResult = await tools.handleToolCall('predict_next_action', predictArgs); console.log(` āœ… Predictions generated: ${predictResult.success}`); console.log(` šŸŽÆ Top prediction: ${predictResult.recommended_action?.action || 'N/A'}`); console.log(` šŸ¤– Suggested agent: ${predictResult.suggested_agent || 'N/A'}`); console.log(` šŸ’­ Reasoning: ${predictResult.reasoning?.substring(0, 50)}...`); console.log(); // Test learn_from_workflow_outcome tool console.log('7. Testing learn_from_workflow_outcome...'); const outcomeArgs = { workflow_id: 'test-workflow-001', initial_request: { type: 'component_creation', description: 'Create a reusable React component', priority: 'medium' }, final_result: { files_created: ['HelloWorld.tsx', 'HelloWorld.test.tsx', 'HelloWorld.module.css'], components_exported: 1, tests_passing: true, documentation_added: true }, success: true, involved_agents: ['test-agent', 'style-generator', 'test-generator'], total_duration: 4500, user_satisfaction: 0.92 }; const outcomeResult = await tools.handleToolCall('learn_from_workflow_outcome', outcomeArgs); console.log(` āœ… Workflow outcome learned: ${outcomeResult.success}`); console.log(` šŸ† Learning impact: ${outcomeResult.learning_impact || 'positive'}`); console.log(` šŸ“ Pattern ID: ${outcomeResult.pattern_id?.substring(0, 8)}...`); console.log(` šŸ’” Next recommendations: ${outcomeResult.recommendations?.length || 0}\n`); // Test get_agent_performance_metrics tool console.log('8. Testing get_agent_performance_metrics...'); const metricsResult = await tools.handleToolCall('get_agent_performance_metrics', { agent_id: 'test-agent', time_range: '24h' }); console.log(` āœ… Metrics retrieved: ${metricsResult.success}`); console.log(` šŸ¤– Agent ID: ${metricsResult.agent_id}`); console.log(` šŸ“Š Time range: ${metricsResult.time_range}`); if (metricsResult.summary) { console.log(` šŸ„ Overall health: ${metricsResult.summary.overall_health}`); console.log(` šŸ’” Key insights: ${metricsResult.summary.key_insights?.length || 0}`); console.log(` šŸ”§ Recommendations: ${metricsResult.summary.recommendations?.length || 0}`); } console.log(); // Test cleanup console.log('9. Testing cleanup...'); await tools.cleanup(); console.log(' āœ… Cleanup completed\n'); console.log('āœ… All Claudio integration tests passed!\n'); console.log('šŸ¤– Claudio can now use these MCP tools:'); toolDefinitions.forEach(tool => { console.log(` • ${tool.name}`); }); console.log(); } catch (error) { console.error('āŒ Claudio integration test failed:', error.message); console.error('Stack trace:', error.stack); process.exit(1); } } // Run the test await testClaudioIntegration();

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/saralegui-solutions/mcp-self-learning-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server