Revise contacts and email tools
All checks were successful
Build And Test / publish (push) Successful in 48s
All checks were successful
Build And Test / publish (push) Successful in 48s
This commit is contained in:
30
test.sh
30
test.sh
@@ -17,12 +17,12 @@ echo "Testing MCP server at $BASE_URL"
|
||||
echo "================================"
|
||||
|
||||
# Test health endpoint
|
||||
echo -e "\n[1/5] Testing health endpoint..."
|
||||
echo -e "\n[1/6] Testing health endpoint..."
|
||||
HEALTH=$(curl -s "$BASE_URL/health")
|
||||
echo "Response: $HEALTH"
|
||||
|
||||
# Initialize session and capture session ID
|
||||
echo -e "\n[2/5] Initializing MCP session..."
|
||||
echo -e "\n[2/6] Initializing MCP session..."
|
||||
INIT_RESPONSE=$(curl -s -D - -X POST "$MCP_ENDPOINT" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Accept: application/json, text/event-stream" \
|
||||
@@ -55,12 +55,12 @@ mcp_request() {
|
||||
}
|
||||
|
||||
# List available tools
|
||||
echo -e "\n[3/5] Listing available tools..."
|
||||
echo -e "\n[3/6] Listing available tools..."
|
||||
TOOLS=$(mcp_request 2 "tools/list" "{}")
|
||||
echo "$TOOLS" | grep -o '"name":"[^"]*"' | head -20 || echo "$TOOLS"
|
||||
|
||||
# Get server info
|
||||
echo -e "\n[4/5] Getting server info..."
|
||||
echo -e "\n[4/6] Getting server info..."
|
||||
SERVER_INFO=$(mcp_request 3 "tools/call" '{"name":"get_server_info","arguments":{}}')
|
||||
echo "$SERVER_INFO"
|
||||
|
||||
@@ -69,20 +69,18 @@ echo -e "\n[5/7] Listing mailboxes..."
|
||||
MAILBOXES=$(mcp_request 4 "tools/call" '{"name":"list_mailboxes","arguments":{}}')
|
||||
echo "$MAILBOXES"
|
||||
|
||||
# List address books
|
||||
echo -e "\n[6/7] Listing address books..."
|
||||
ADDRESSBOOKS=$(mcp_request 5 "tools/call" '{"name":"list_addressbooks","arguments":{}}')
|
||||
echo "$ADDRESSBOOKS"
|
||||
# List contacts
|
||||
echo -e "\n[6/7] Listing contacts..."
|
||||
CONTACTS=$(mcp_request 5 "tools/call" '{"name":"list_contacts","arguments":{"limit":10}}')
|
||||
echo "$CONTACTS"
|
||||
|
||||
# List contacts (using first addressbook from previous response)
|
||||
echo -e "\n[7/7] Listing contacts..."
|
||||
# Extract first addressbook ID from previous response
|
||||
ADDRESSBOOK_ID=$(echo "$ADDRESSBOOKS" | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4)
|
||||
if [ -n "$ADDRESSBOOK_ID" ]; then
|
||||
CONTACTS=$(mcp_request 6 "tools/call" "{\"name\":\"list_contacts\",\"arguments\":{\"addressbook_id\":\"$ADDRESSBOOK_ID\",\"limit\":10}}")
|
||||
echo "$CONTACTS"
|
||||
# Draft a reply (requires REPLY_EMAIL_ID)
|
||||
echo -e "\n[7/7] Drafting reply..."
|
||||
if [ -n "$REPLY_EMAIL_ID" ]; then
|
||||
DRAFT_REPLY=$(mcp_request 6 "tools/call" "{\"name\":\"save_draft\",\"arguments\":{\"in_reply_to_email_id\":\"$REPLY_EMAIL_ID\",\"in_reply_to_mailbox\":\"INBOX\",\"reply_all\":false,\"body\":\"Test reply draft\"}}")
|
||||
echo "$DRAFT_REPLY"
|
||||
else
|
||||
echo "No addressbook found to list contacts from"
|
||||
echo "Skipping reply draft: set REPLY_EMAIL_ID to an email UID to test threading"
|
||||
fi
|
||||
|
||||
echo -e "\n================================"
|
||||
|
||||
Reference in New Issue
Block a user