#!/bin/bash # Test all MCP tools MCP_URL="http://localhost:8000/mcp" echo "==========================================" echo "Testing MCP Server - All Tools" echo "==========================================" echo "" # Test 1: List all tools echo "1. Testing tools/list..." TOOLS=$(curl -s -X POST "$MCP_URL" \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}') TOOL_COUNT=$(echo "$TOOLS" | python3 -c "import sys, json; data=json.load(sys.stdin); print(len(data['result']['tools']))" 2>/dev/null) echo " ✓ Found $TOOL_COUNT tools" echo "" # Test 2: Echo tool echo "2. Testing echo tool..." RESULT=$(curl -s -X POST "$MCP_URL" \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "echo", "arguments": {"text": "Hello!"}}, "id": 2}') echo " ✓ $(echo "$RESULT" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['result']['content'][0]['text'])" 2>/dev/null)" echo "" # Test 3: Get current time echo "3. Testing get_current_time tool..." RESULT=$(curl -s -X POST "$MCP_URL" \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "get_current_time", "arguments": {}}, "id": 3}') echo " ✓ $(echo "$RESULT" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['result']['content'][0]['text'])" 2>/dev/null | head -1)" echo "" # Test 4: Get date echo "4. Testing get_date tool..." RESULT=$(curl -s -X POST "$MCP_URL" \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "get_date", "arguments": {}}, "id": 4}') echo " ✓ $(echo "$RESULT" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['result']['content'][0]['text'])" 2>/dev/null | head -1)" echo "" # Test 5: Get timezone info echo "5. Testing get_timezone_info tool..." RESULT=$(curl -s -X POST "$MCP_URL" \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "get_timezone_info", "arguments": {}}, "id": 5}') echo " ✓ $(echo "$RESULT" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['result']['content'][0]['text'])" 2>/dev/null | head -1)" echo "" # Test 6: Convert timezone echo "6. Testing convert_timezone tool..." RESULT=$(curl -s -X POST "$MCP_URL" \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "convert_timezone", "arguments": {"to_timezone": "Europe/London"}}, "id": 6}') echo " ✓ $(echo "$RESULT" | python3 -c "import sys, json; data=json.load(sys.stdin); print(data['result']['content'][0]['text'])" 2>/dev/null | head -1)" echo "" echo "==========================================" echo "✅ All 6 tools tested successfully!" echo "=========================================="