#!/usr/bin/env python3 """ Debug agent names to understand the recommendation issue """ import asyncio import os from pathlib import Path import sys # Add the source directory to the path sys.path.insert(0, str(Path(__file__).parent / "src")) from agent_mcp_server.server import AgentLibrary async def debug_agent_names(): """Debug agent names""" print("šŸ” Debugging Agent Names") print("=" * 40) # Initialize agent library with local templates templates_path = Path(__file__).parent / "agent_templates" library = AgentLibrary(templates_path) await library.initialize() print(f"\nšŸ“‹ All loaded agents:") for name, agent in sorted(library.agents.items()): print(f" • {agent.agent_type:>10} | {agent.emoji} {name}") if agent.parent_agent: print(f" └─ Parent: {agent.parent_agent}") if agent.sub_agents: print(f" └─ Sub-agents: {agent.sub_agents}") print(f"\nšŸ”§ Testing specific keyword matches:") # Test the keywords we expect to match keywords_to_test = ["python testing", "html report", "testing framework", "testing"] for keyword in keywords_to_test: print(f"\nšŸŽÆ Testing keyword: '{keyword}'") matching_agents = [] for name, agent in library.agents.items(): if keyword.lower().replace(" ", "") in name.lower().replace("-", ""): matching_agents.append(f"{agent.emoji} {name} ({agent.agent_type})") if matching_agents: print(f" Matches found:") for match in matching_agents: print(f" • {match}") else: print(f" No matches found") if __name__ == "__main__": asyncio.run(debug_agent_names())