-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-tool-metrics.sh
More file actions
executable file
·45 lines (35 loc) · 1.08 KB
/
test-tool-metrics.sh
File metadata and controls
executable file
·45 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# Test script for tool metrics functionality
set -e
echo "=== Starting MCP Bridge with Tool Metrics ==="
# Start the bridge in background
./bin/mcp-bridge &
BRIDGE_PID=$!
sleep 3
echo "=== Bridge started with PID $BRIDGE_PID ==="
# Test 1: Make a tool call request
echo ""
echo "=== Test 1: Making tool call request ==="
curl -X POST http://localhost:8080/mcp/test \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"echo"}}'
echo ""
echo "=== Waiting for response ==="
sleep 2
# Test 2: Check Prometheus metrics
echo ""
echo "=== Test 2: Checking Prometheus metrics ==="
curl http://localhost:8080/metrics | grep -E "mcp_tool_calls|mcp_http_requests|mcp_active_sessions"
echo ""
echo "=== Test 3: Checking debug stream (first 5 events) ==="
curl -N http://localhost:8080/debug/stream 2>&1 | head -c 2000 &
DEBUG_PID=$!
sleep 3
kill $DEBUG_PID 2>/dev/null || true
# Cleanup
echo ""
echo "=== Stopping bridge ==="
kill $BRIDGE_PID 2>/dev/null || true
wait $BRIDGE_PID 2>/dev/null || true
echo ""
echo "=== Tests completed ==="