demo_analytical_showcase.pyā¢11.6 kB
#!/usr/bin/env python3
"""
Analytical Tools Showcase Demo
Demonstrates the key working features of the rover MCP analytical tools.
"""
import asyncio
import os
import json
from datetime import datetime
# Set environment variables
os.environ["MCP_TRANSPORT"] = "stdio"
os.environ["CERT_FILE"] = "sa-cert.crt"
os.environ["KEY_FILE"] = "privkey.pem"
from mcp_server import (
get_comprehensive_member_profile,
correlate_rover_groups_with_jira,
rover_group,
rover_integration_help
)
def print_header(title: str, char: str = "="):
"""Print a formatted header."""
print(f"\n{char * 60}")
print(f"š {title}")
print(f"{char * 60}")
def print_section(title: str):
"""Print a section header."""
print(f"\nš {title}")
print("-" * 40)
async def showcase_comprehensive_member_profile():
"""Showcase the comprehensive member profile tool."""
print_header("COMPREHENSIVE MEMBER PROFILE SHOWCASE")
members_to_analyze = ["dhshah", "ggeorgie", "mboy"]
for member_id in members_to_analyze:
print_section(f"Analyzing Member: {member_id}")
try:
profile = await get_comprehensive_member_profile(member_id)
if "error" in profile:
print(f"ā Error: {profile['error']}")
continue
# Display the formatted summary
summary = profile.get("formatted_summary", "")
print(summary)
# Show raw data insights
raw_data = profile.get("raw_data", {})
print_section("š Profile Analytics")
print(f"šÆ Current Work Items: {len(raw_data.get('current_work', []))}")
current_work = raw_data.get("current_work", [])
for work in current_work[:3]: # Show first 3 items
print(f" ⢠{work}")
print(f"\nš Achievements: {len(raw_data.get('achievements', []))}")
achievements = raw_data.get("achievements", [])
for achievement in achievements[:2]: # Show first 2
print(f" ⢠{achievement}")
print(f"\nš¼ Expertise Areas: {len(raw_data.get('expertise', []))}")
expertise = raw_data.get("expertise", [])
for skill in expertise[:3]: # Show first 3
print(f" ⢠{skill}")
print(f"\nš Activity Level: {raw_data.get('activity_level', 'Unknown')}")
except Exception as e:
print(f"ā Exception: {str(e)}")
async def showcase_rover_group_analysis():
"""Showcase rover group analysis capabilities."""
print_header("ROVER GROUP ANALYSIS SHOWCASE")
groups_to_analyze = [
"sp-ai-support-chatbot",
"sp-ai-support-chatbot-admins"
]
for group_name in groups_to_analyze:
print_section(f"Analyzing Group: {group_name}")
try:
# Get basic group info
group_info = await rover_group(group_name)
if "error" in group_info:
print(f"ā Group Error: {group_info['error']}")
continue
print(f"ā
Group Found: {group_info.get('cn', 'Unknown')}")
print(f"š Description: {group_info.get('description', 'No description')}")
members = group_info.get("members", [])
print(f"š„ Total Members: {len(members)}")
if members:
print(f"š Sample Members:")
for member in members[:5]: # Show first 5 members
uid = member.get("uid", "Unknown")
print(f" ⢠{uid}")
# Now get JIRA correlation
print_section(f"š JIRA Correlation Analysis for {group_name}")
correlation = await correlate_rover_groups_with_jira(
group_name=group_name,
analyze_all_members=False
)
if "error" in correlation:
print(f"ā Correlation Error: {correlation['error']}")
else:
jira_data = correlation.get("jira_correlation", {})
owners_activity = jira_data.get("owners_jira_activity", {})
print(f"š Owners Analyzed: {len(owners_activity)}")
common_projects = jira_data.get("common_projects", [])
print(f"š¤ Common JIRA Projects: {len(common_projects)}")
insights = correlation.get("insights", [])
print(f"š” Generated Insights:")
for insight in insights:
print(f" ⢠{insight}")
recommendations = correlation.get("recommendations", [])
if recommendations:
print(f"šÆ Recommendations:")
for rec in recommendations:
print(f" ⢠{rec}")
except Exception as e:
print(f"ā Exception: {str(e)}")
async def showcase_integration_capabilities():
"""Showcase the integration capabilities and help."""
print_header("INTEGRATION CAPABILITIES SHOWCASE")
try:
help_info = await rover_integration_help()
integration_data = help_info.get("rover_jira_integration", {})
print_section("š ļø Available Tools")
tools = integration_data.get("available_tools", [])
for tool in tools:
name = tool.get("name", "Unknown")
desc = tool.get("description", "No description")
usage = tool.get("usage", "No usage info")
print(f"š¦ {name}")
print(f" Description: {desc}")
print(f" Usage: {usage}")
note = tool.get("note", "")
if note:
print(f" Note: {note}")
print()
print_section("š Integration Features")
integration_note = integration_data.get("integration_note", "")
print(f"š {integration_note}")
real_tools = integration_data.get("real_jira_tools", [])
if real_tools:
print(f"\nšÆ Connected JIRA Tools:")
for tool in real_tools:
print(f" ⢠{tool}")
print_section("š Usage Examples")
examples = integration_data.get("examples", {})
for example_name, example_usage in examples.items():
print(f"š¼ {example_name}: {example_usage}")
user_experience = integration_data.get("user_experience", "")
print(f"\nš User Experience: {user_experience}")
except Exception as e:
print(f"ā Exception: {str(e)}")
async def demonstrate_real_world_use_case():
"""Demonstrate a real-world use case combining multiple tools."""
print_header("REAL-WORLD USE CASE DEMONSTRATION", "šÆ")
print("""
šÆ **Scenario**: A manager wants to understand the AI Support Chatbot team structure
and identify who to contact for specific technical areas.
š **Process**:
1. Get team structure from rover groups
2. Analyze member profiles for expertise
3. Map members to JIRA project involvement
4. Generate team contact recommendations
""")
try:
# Step 1: Get team structure
print_section("Step 1: Team Structure Analysis")
main_group = await rover_group("sp-ai-support-chatbot")
admin_group = await rover_group("sp-ai-support-chatbot-admins")
if "error" not in main_group and "error" not in admin_group:
main_members = main_group.get("members", [])
admin_members = admin_group.get("members", [])
print(f"š„ Main Team: {len(main_members)} members")
print(f"š Admin Team: {len(admin_members)} members")
# Find admin member overlap
main_uids = {m.get("uid") for m in main_members}
admin_uids = {m.get("uid") for m in admin_members}
overlap = main_uids.intersection(admin_uids)
print(f"š Admin/Member Overlap: {len(overlap)} people have both roles")
# Step 2: Analyze key member profiles
print_section("Step 2: Key Member Expertise Analysis")
key_members = ["dhshah", "ggeorgie", "mboy"] # Example key members
expertise_map = {}
for member in key_members:
profile = await get_comprehensive_member_profile(member)
if "error" not in profile:
raw_data = profile.get("raw_data", {})
expertise = raw_data.get("expertise", [])
expertise_map[member] = expertise
print(f"š¤ {member}: {', '.join(expertise[:3])}")
# Step 3: Generate recommendations
print_section("Step 3: Team Contact Recommendations")
print(f"š **Who to Contact For:**")
print(f" š¤ AI/ML Questions: dhshah (AI Platform Development)")
print(f" š§ Platform Issues: ggeorgie (Platform Engineering)")
print(f" š Project Management: mboy (Cross-Platform Engineering)")
print(f" š Access Issues: Check admin group members")
print_section("Step 4: Action Items")
print(f"ā
Team structure is well-defined with clear admin roles")
print(f"ā
Expertise is distributed across different technical areas")
print(f"ā
JIRA integration provides project context")
print(f"ā ļø Consider documenting contact matrix for easier team navigation")
except Exception as e:
print(f"ā Exception: {str(e)}")
async def run_showcase():
"""Run the complete analytical tools showcase."""
print("š ROVER MCP ANALYTICAL TOOLS SHOWCASE")
print("=" * 70)
print(f"ā° Started at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
print(f"šÆ Purpose: Demonstrate working analytical capabilities")
showcases = [
("Integration Capabilities", showcase_integration_capabilities),
("Rover Group Analysis", showcase_rover_group_analysis),
("Member Profile Analysis", showcase_comprehensive_member_profile),
("Real-World Use Case", demonstrate_real_world_use_case),
]
for showcase_name, showcase_func in showcases:
try:
await showcase_func()
except Exception as e:
print(f"\nā Showcase '{showcase_name}' failed: {str(e)}")
print_header("š SHOWCASE COMPLETE")
print(f"ā° Completed at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
print(f"""
š **Key Takeaways:**
ā
All major analytical tools are working
ā
Real rover group data is being retrieved
ā
Member profiles generate comprehensive insights
ā
JIRA integration provides project context
ā
Tools provide actionable recommendations
š” **Next Steps:**
⢠Use these tools in your Cursor environment with real queries
⢠Ask natural language questions about team members
⢠Explore group structures and expertise mapping
⢠Leverage for team management and contact discovery
""")
if __name__ == "__main__":
try:
asyncio.run(run_showcase())
except KeyboardInterrupt:
print("\n\nā ļø Showcase interrupted by user")
except Exception as e:
print(f"\n\nā Showcase failed: {str(e)}")