Skip to main content
Glama

MCP Orchestration Server

test_misspelling_fix.py•4.19 kB
#!/usr/bin/env python3 """ Test misspelling fix for city names """ import requests import json def test_misspelling_fix(): """Test that misspelled city names are corrected.""" print("šŸ”¤ Testing City Name Misspelling Fix") print("=" * 50) # Test misspelled city names misspelling_tests = [ ("weather in banglore", "Bangalore"), ("weather in bengaluru", "Bangalore"), ("weather in bombay", "Mumbai"), ("weather in calcutta", "Kolkata"), ("weather in madras", "Chennai"), ("weather in new delhi", "Delhi"), ("weather in ny", "New York"), ("weather in nyc", "New York"), ("weather in la", "Los Angeles") ] for query, expected_city in misspelling_tests: print(f"\nšŸ” Testing: '{query}' → Should return {expected_city}") 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 corrected actual_location = result.get('location', '') if expected_city.lower() in actual_location.lower(): print(f"āœ… CORRECT: Misspelling corrected to {actual_location}!") else: print(f"āŒ WRONG: Expected {expected_city}, got {actual_location}") if 'current' in result: current = result['current'] print(f"šŸŒ”ļø Temperature: {current.get('temperature', 'N/A')}") print(f"ā˜ļø Condition: {current.get('condition', 'N/A')}") if 'summary' in result: print(f"šŸ“ Summary: {result['summary']}") else: print(f"āŒ WRONG: Routed to {result.get('type')} instead of weather") else: print(f"āŒ Request failed: {response.status_code}") except Exception as e: print(f"āŒ Error: {e}") # Test correct spellings still work print(f"\nāœ… Testing Correct Spellings Still Work:") correct_tests = [ ("weather in bangalore", "Bangalore"), ("weather in mumbai", "Mumbai"), ("weather in delhi", "Delhi"), ("weather in london", "London") ] for query, expected_city in correct_tests: try: response = requests.post( 'http://localhost:8000/api/mcp/command', json={'command': query}, timeout=30 ) if response.status_code == 200: result = response.json() actual_location = result.get('location', '') print(f"šŸ” '{query}' → {actual_location}") if expected_city.lower() in actual_location.lower(): print(" āœ… Correct spelling works!") else: print(f" āŒ Expected {expected_city}, got {actual_location}") except Exception as e: print(f"āŒ Error testing {query}: {e}") print(f"\nšŸŽÆ MISSPELLING FIX TEST COMPLETE") print("=" * 50) print("āœ… Common misspellings should be corrected") print("āœ… banglore → bangalore") print("āœ… bombay → mumbai") print("āœ… calcutta → kolkata") print("āœ… Correct spellings should still work") if __name__ == "__main__": test_misspelling_fix()

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