Skip to main content
Glama

MCP Agent Tracker

by Big0290
test_filtering.py•3.31 kB
#!/usr/bin/env python3 """ Test script to verify interaction filtering logic """ import sqlite3 import os def test_filtering_logic(): """Test the filtering logic used in the UI""" print("šŸ” Testing Interaction Filtering Logic") print("=" * 60) db_path = "./data/agent_tracker.db" if not os.path.exists(db_path): print(f"āŒ Database not found: {db_path}") return try: conn = sqlite3.connect(db_path) cursor = conn.cursor() # Test 1: Total count cursor.execute("SELECT COUNT(*) FROM agent_interactions") total_count = cursor.fetchone()[0] print(f"šŸ“Š Total interactions: {total_count}") # Test 2: Filter by conversation types conversation_types = ['conversation_turn', 'client_request', 'agent_response', 'user_prompt'] placeholders = ','.join(['?'] * len(conversation_types)) query = f"SELECT COUNT(*) FROM agent_interactions WHERE interaction_type IN ({placeholders})" cursor.execute(query, conversation_types) conversation_count = cursor.fetchone()[0] print(f"šŸ’¬ Conversation types ({', '.join(conversation_types)}): {conversation_count}") # Test 3: Filter by system types system_types = ['health_check', 'monitoring_started', 'module_import', 'system_startup', 'system_shutdown'] placeholders = ','.join(['?'] * len(system_types)) query = f"SELECT COUNT(*) FROM agent_interactions WHERE interaction_type IN ({placeholders})" cursor.execute(query, system_types) system_count = cursor.fetchone()[0] print(f"āš™ļø System types ({', '.join(system_types)}): {system_count}") # Test 4: Filter by tool types tool_types = ['tool_call', 'tool_response', 'tool_error'] placeholders = ','.join(['?'] * len(tool_types)) query = f"SELECT COUNT(*) FROM agent_interactions WHERE interaction_type IN ({placeholders})" cursor.execute(query, tool_types) tool_count = cursor.fetchone()[0] print(f"šŸ”§ Tool types ({', '.join(tool_types)}): {tool_count}") # Test 5: Verify totals calculated_total = conversation_count + system_count + tool_count print(f"🧮 Calculated total: {calculated_total}") print(f"āœ… Match: {'Yes' if calculated_total == total_count else 'No'}") # Test 6: Show all interaction types print(f"\nšŸ“‹ All interaction types:") cursor.execute("SELECT interaction_type, COUNT(*) FROM agent_interactions GROUP BY interaction_type ORDER BY COUNT(*) DESC") for interaction_type, count in cursor.fetchall(): print(f" • {interaction_type}: {count}") conn.close() except Exception as e: print(f"āŒ Error: {e}") def main(): """Main test function""" print("šŸš€ Interaction Filtering Test") print("=" * 60) test_filtering_logic() print(f"\nšŸŽÆ Expected Results:") print(f"• Total: 617 interactions") print(f"• Conversations: 107 interactions") print(f"• System: 501 interactions") print(f"• Tools: 16 interactions") print(f"• Total: 107 + 501 + 16 = 624 (should match 617)") if __name__ == "__main__": main()

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