BASE="http://127.0.0.1:8002"
curl -s -N -m 12 "$BASE/sse" > /tmp/sse6.txt &
CP=$!
sleep 2
SID=$(grep -oP 'session_id=\K[^/]+' /tmp/sse6.txt | head -1)
curl -s -m 4 -X POST "$BASE/messages/?session_id=$SID" -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' >/dev/null
sleep 2
curl -s -m 4 -X POST "$BASE/messages/?session_id=$SID" -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' >/dev/null
sleep 3
kill $CP 2>/dev/null
grep -oP '(name"\s*:\s*")[^"]+' /tmp/sse6.txt | head -30
echo '--- all lines with name:'
grep -E 'name.*tool|description' /tmp/sse6.txt | head -5
