Skip to content

Commit 2c341be

Browse files
committed
debug: add session ID extraction debugging and case variations
Added debugging to see: - All response header keys when session ID not found - Try multiple case variations of Mcp-Session-Id header - Print when session ID is successfully extracted This will help identify why session isn't persisting across requests.
1 parent b5152d8 commit 2c341be

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test_http_agentic_tools.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,16 @@ def send_request(self, payload, timeout=60):
177177

178178
if response.status_code == 200:
179179
# Extract session ID from response header (first request only)
180-
if self.session_id is None and "Mcp-Session-Id" in response.headers:
181-
self.session_id = response.headers["Mcp-Session-Id"]
182-
print(f" 📝 Session ID: {self.session_id[:16]}...")
180+
# Headers are case-insensitive in requests
181+
if self.session_id is None:
182+
# Try different case variations
183+
for key in ['Mcp-Session-Id', 'mcp-session-id', 'MCP-SESSION-ID']:
184+
if key in response.headers:
185+
self.session_id = response.headers[key]
186+
print(f" 📝 Session ID: {self.session_id[:16]}...")
187+
break
188+
if self.session_id is None:
189+
print(f" ⚠️ No session ID in headers: {list(response.headers.keys())}")
183190

184191
# Parse SSE stream for JSON-RPC responses
185192
result_data = None

0 commit comments

Comments
 (0)