#!/bin/bash
# End-to-end test script for CFB MCP application
# Tests GPT-5 Responses API integration and tool calling
API_BASE="https://prompt80.com/cfb-mcp/api"
TOKEN="cfb-mcp-secure-token-2025"
echo "=========================================="
echo "CFB MCP End-to-End Test Suite"
echo "Testing GPT-5 with Responses API"
echo "=========================================="
echo ""
# Test 1: Today's game query (should use get_game_odds_and_score)
echo "TEST 1: Today's game query - 'Did Miami win today?'"
echo "Expected: Should call get_game_odds_and_score tool"
echo "---"
curl -s -X POST "${API_BASE}/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{"message": "Did Miami win today?"}' | jq -r '.reply' | head -20
echo ""
echo "---"
echo ""
sleep 2
# Test 2: Recent results query (should use get_team_recent_results)
echo "TEST 2: Recent results query - 'What are Alabama's recent game results?'"
echo "Expected: Should call get_team_recent_results tool"
echo "---"
curl -s -X POST "${API_BASE}/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{"message": "What are Alabama recent game results?"}' | jq -r '.reply' | head -20
echo ""
echo "---"
echo ""
sleep 2
# Test 3: Team info query (should use get_team_info)
echo "TEST 3: Team info query - 'Tell me about Georgia season record and ranking'"
echo "Expected: Should call get_team_info tool"
echo "---"
curl -s -X POST "${API_BASE}/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{"message": "Tell me about Georgia season record and ranking"}' | jq -r '.reply' | head -20
echo ""
echo "---"
echo ""
sleep 2
# Test 4: Next game query (should use get_next_game_odds)
echo "TEST 4: Next game query - 'Who does Ohio State play next and what are the odds?'"
echo "Expected: Should call get_next_game_odds tool"
echo "---"
curl -s -X POST "${API_BASE}/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{"message": "Who does Ohio State play next and what are the odds?"}' | jq -r '.reply' | head -20
echo ""
echo "---"
echo ""
sleep 2
# Test 5: Player stats query (should use get_recent_player_stats)
echo "TEST 5: Player stats query - 'How has Jalen Milroe performed recently?'"
echo "Expected: Should call get_recent_player_stats tool"
echo "---"
curl -s -X POST "${API_BASE}/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{"message": "How has Jalen Milroe performed recently?"}' | jq -r '.reply' | head -20
echo ""
echo "---"
echo ""
sleep 2
# Test 6: Complex query (should use multiple tools)
echo "TEST 6: Complex query - 'Tell me about Michigan season and their next game'"
echo "Expected: Should call get_team_info and get_next_game_odds tools"
echo "---"
curl -s -X POST "${API_BASE}/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{"message": "Tell me about Michigan season and their next game"}' | jq -r '.reply' | head -30
echo ""
echo "---"
echo ""
echo "=========================================="
echo "Test Suite Complete"
echo "=========================================="