Skip to main content
Glama

MCP Agent Tracker

by Big0290
test_conversation_tracking.pyโ€ข4.28 kB
#!/usr/bin/env python3 """ Test script for conversation tracking functionality This tests the core tracking without requiring MCP packages """ import os import sys import time from datetime import datetime # Add current directory to path for imports sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) def test_conversation_tracking(): """Test the conversation tracking functionality""" print("๐Ÿงช Testing Conversation Tracking System...") try: # Test 1: Import the logger print("๐Ÿ“ฆ Testing imports...") from interaction_logger import logger print("โœ… Interaction logger imported successfully") # Test 2: Test session creation print("๐Ÿ”‘ Testing session creation...") session_id = logger.get_or_create_session() print(f"โœ… Session created: {session_id}") # Test 3: Test client request logging print("๐Ÿ“ Testing client request logging...") logger.log_client_request("What's the weather like?") print("โœ… Client request logged successfully") # Test 4: Test agent response logging print("๐Ÿค– Testing agent response logging...") logger.log_agent_response("The weather is sunny and warm.") print("โœ… Agent response logged successfully") # Test 5: Test conversation turn logging print("๐Ÿ”„ Testing conversation turn logging...") logger.log_conversation_turn( client_request="What's the weather like?", agent_response="The weather is sunny and warm." ) print("โœ… Conversation turn logged successfully") # Test 6: Test custom interaction logging print("๐Ÿ“Š Testing custom interaction logging...") logger.log_interaction( interaction_type='test_interaction', client_request="Test request", agent_response="Test response", metadata={'test': True, 'timestamp': datetime.utcnow().isoformat()} ) print("โœ… Custom interaction logged successfully") # Test 7: Test error logging print("โŒ Testing error logging...") logger.log_interaction( interaction_type='test_error', error_message="This is a test error", status='error' ) print("โœ… Error logged successfully") print("\n๐ŸŽ‰ All tests passed! Conversation tracking is working correctly.") print(f"๐Ÿ“Š Session ID: {session_id}") print("๐Ÿ’ก The system is now ready to track client-agent conversations automatically.") return True except Exception as e: print(f"โŒ Test failed: {e}") import traceback traceback.print_exc() return False def test_configuration(): """Test configuration loading""" print("\nโš™๏ธ Testing Configuration...") try: from config import Config print("โœ… Configuration imported successfully") print(f"๐ŸŒ Environment: {Config.ENVIRONMENT}") print(f"๐Ÿ“Š Background Monitoring: {Config.ENABLE_BACKGROUND_MONITORING}") print(f"โฑ๏ธ Monitoring Interval: {Config.MONITORING_INTERVAL_SECONDS} seconds") print(f"๐Ÿ” Automatic Metadata: {Config.ENABLE_AUTOMATIC_METADATA}") return True except Exception as e: print(f"โŒ Configuration test failed: {e}") return False if __name__ == "__main__": print("๐Ÿš€ Starting Conversation Tracking Tests...\n") config_ok = test_configuration() tracking_ok = test_conversation_tracking() print("\n" + "="*50) if config_ok and tracking_ok: print("๐ŸŽฏ ALL TESTS PASSED!") print("โœ… Configuration: Working") print("โœ… Conversation Tracking: Working") print("\n๐Ÿ’ก Your MCP server is ready to track conversations automatically!") else: print("โŒ SOME TESTS FAILED!") if not config_ok: print("โŒ Configuration: Failed") if not tracking_ok: print("โŒ Conversation Tracking: Failed") print("\n๐Ÿ”ง Please check the error messages above and fix any issues.") print("="*50)

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/Big0290/MCP'

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