Last active
December 21, 2025 10:27
-
-
Save lukehinds/908ef310db935247430936563f0b68b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Load comprehensive Google Workspace mock data into the mock tools server | |
| # | |
| # Usage: ./load-google-workspace-mock-data.sh [base_url] | |
| # Default base_url: http://localhost:3000 | |
| set -e | |
| BASE_URL="${1:-http://localhost:3000}" | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| DATA_FILE="$SCRIPT_DIR/google-workspace-mock-data.json" | |
| if [ ! -f "$DATA_FILE" ]; then | |
| echo "Error: Mock data file not found at $DATA_FILE" | |
| exit 1 | |
| fi | |
| echo "Loading Google Workspace mock data from $DATA_FILE" | |
| echo "Target server: $BASE_URL" | |
| echo "" | |
| # Function to load mock response for a tool | |
| load_mock_response() { | |
| local tool_name="$1" | |
| local response="$2" | |
| echo "Loading mock response for: $tool_name" | |
| curl -s -X POST "$BASE_URL/mock/update-response" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"name\": \"$tool_name\", \"mockResponse\": $response}" > /dev/null | |
| if [ $? -eq 0 ]; then | |
| echo " Done" | |
| else | |
| echo " Failed!" | |
| fi | |
| } | |
| # Function to add a fixture | |
| add_fixture() { | |
| local tool_name="$1" | |
| local match="$2" | |
| local response="$3" | |
| echo "Adding fixture for: $tool_name (match: $match)" | |
| curl -s -X POST "$BASE_URL/mock/add-fixture" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"name\": \"$tool_name\", \"match\": $match, \"response\": $response}" > /dev/null | |
| if [ $? -eq 0 ]; then | |
| echo " Done" | |
| else | |
| echo " Failed!" | |
| fi | |
| } | |
| echo "==========================================" | |
| echo "Loading default mock responses..." | |
| echo "==========================================" | |
| # Load default mock responses using jq | |
| for tool in $(jq -r '.mockResponses | keys[]' "$DATA_FILE"); do | |
| response=$(jq -c ".mockResponses.\"$tool\".defaultResponse" "$DATA_FILE") | |
| if [ "$response" != "null" ]; then | |
| load_mock_response "$tool" "$response" | |
| fi | |
| done | |
| echo "" | |
| echo "==========================================" | |
| echo "Loading fixtures..." | |
| echo "==========================================" | |
| # Load fixtures for each tool | |
| for tool in $(jq -r '.fixtures | keys[]' "$DATA_FILE"); do | |
| fixture_count=$(jq -r ".fixtures.\"$tool\" | length" "$DATA_FILE") | |
| for i in $(seq 0 $((fixture_count - 1))); do | |
| match=$(jq -c ".fixtures.\"$tool\"[$i].match" "$DATA_FILE") | |
| response=$(jq -c ".fixtures.\"$tool\"[$i].response" "$DATA_FILE") | |
| add_fixture "$tool" "$match" "$response" | |
| done | |
| done | |
| echo "" | |
| echo "==========================================" | |
| echo "Mock data loaded successfully!" | |
| echo "==========================================" | |
| echo "" | |
| echo "Test commands:" | |
| echo "" | |
| echo "# Search Gmail for emails from boss" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"search_gmail_messages\", \"arguments\": {\"query\": \"from:boss@company.com\"}}'" | |
| echo "" | |
| echo "# Search Gmail for unread emails" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"search_gmail_messages\", \"arguments\": {\"query\": \"is:unread\"}}'" | |
| echo "" | |
| echo "# Get specific email message" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"get_gmail_message_content\", \"arguments\": {\"message_id\": \"msg_boss_001\"}}'" | |
| echo "" | |
| echo "# Search Drive for Q4 reports" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"search_drive_files\", \"arguments\": {\"query\": \"Q4 report\"}}'" | |
| echo "" | |
| echo "# List today's calendar events" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"get_events\", \"arguments\": {\"calendar_id\": \"primary\", \"time_min\": \"2024-12-20T00:00:00Z\"}}'" | |
| echo "" | |
| echo "# Search for documents" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"search_docs\", \"arguments\": {\"query\": \"standup\"}}'" | |
| echo "" | |
| echo "# Get document content" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"get_doc_content\", \"arguments\": {\"document_id\": \"doc_standup_notes\"}}'" | |
| echo "" | |
| echo "# Read spreadsheet values" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"read_sheet_values\", \"arguments\": {\"spreadsheet_id\": \"sheet_q4_data\", \"range\": \"Sheet1!A1:D10\"}}'" | |
| echo "" | |
| echo "# List tasks" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"list_tasks\", \"arguments\": {\"task_list_id\": \"tasklist_001\"}}'" | |
| echo "" | |
| echo "# Get chat messages in Engineering space" | |
| echo "curl -X POST $BASE_URL/mock/execute -H 'Content-Type: application/json' \\" | |
| echo " -d '{\"name\": \"get_messages\", \"arguments\": {\"space_id\": \"AAAA\"}}'" | |
| echo "" | |
| echo "Available mock scenarios:" | |
| echo " - Gmail: Emails from boss, unread messages, invoice searches" | |
| echo " - Drive: Q4 reports, meeting notes" | |
| echo " - Calendar: Today's meetings (standup, 1:1, budget review, lunch)" | |
| echo " - Docs: Standup notes with team updates" | |
| echo " - Sheets: Q4 sales data with revenue breakdown" | |
| echo " - Tasks: Work tasks and personal tasks" | |
| echo " - Chat: Engineering team discussions" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment