Skip to main content
Glama

MCP Orchestration Server

test_bangalore_weather.py•4.22 kB
#!/usr/bin/env python3 """ Test Bangalore weather fix """ import requests import json def test_bangalore_weather(): """Test that Bangalore weather query returns Bangalore weather.""" print("šŸŒ¤ļø Testing Bangalore Weather Fix") print("=" * 50) # Test different Bangalore weather queries bangalore_queries = [ "weather in bangalore", "weather in Bangalore", "bangalore weather", "Bangalore weather", "what is the weather in bangalore", "temperature in bangalore", "how is the weather in bangalore" ] for query in bangalore_queries: print(f"\nšŸ” Testing: '{query}'") try: response = requests.post( 'http://localhost:8000/api/mcp/command', json={'command': query}, timeout=30 ) if response.status_code == 200: result = response.json() print(f"āœ… Status: {result.get('status')}") print(f"šŸŽÆ Type: {result.get('type')}") print(f"šŸ“ Location: {result.get('location', 'N/A')}") # Check if it's weather response if result.get('type') == 'weather': print("āœ… CORRECT: Routed to weather agent!") # Check if location is correct location = result.get('location', '').lower() if 'bangalore' in location or 'bengaluru' in location: print("āœ… CORRECT: Bangalore weather returned!") else: print(f"āŒ WRONG: Got {result.get('location')} instead of Bangalore") if 'current' in result: current = result['current'] print(f"šŸŒ”ļø Temperature: {current.get('temperature', 'N/A')}") print(f"ā˜ļø Condition: {current.get('condition', 'N/A')}") print(f"šŸ’§ Humidity: {current.get('humidity', 'N/A')}") if 'summary' in result: print(f"šŸ“ Summary: {result['summary']}") else: print(f"āŒ WRONG: Routed to {result.get('type')} instead of weather") if 'summary' in result: print(f"šŸ“ Response: {result['summary']}") else: print(f"āŒ Request failed: {response.status_code}") except Exception as e: print(f"āŒ Error: {e}") # Test pattern matching specifically print(f"\nšŸ” Testing Pattern Matching:") test_patterns = [ "weather in mumbai", "mumbai weather", "what is the weather in delhi", "temperature in chennai", "how is the weather in kolkata" ] for query in test_patterns: try: response = requests.post( 'http://localhost:8000/api/mcp/command', json={'command': query}, timeout=30 ) if response.status_code == 200: result = response.json() response_type = result.get('type', 'unknown') location = result.get('location', 'N/A') print(f"šŸ” '{query}' → Type: {response_type}, Location: {location}") if response_type == 'weather': print(" āœ… Correctly routed to weather!") else: print(f" āŒ Incorrectly routed to {response_type}") except Exception as e: print(f"āŒ Error testing {query}: {e}") print(f"\nšŸŽÆ BANGALORE WEATHER FIX TEST COMPLETE") print("=" * 50) print("āœ… Command patterns updated to catch weather queries") print("āœ… Location extraction should work for all formats") print("āœ… Bangalore queries should return Bangalore weather") if __name__ == "__main__": test_bangalore_weather()

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/Nisarg-123-web/MCP2'

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