File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -110,10 +110,11 @@ def send_message(self, data: dict):
110110 json = data ,
111111 headers = {'Content-Type' : 'application/json' , 'trace-id' : data ["id" ] if "id" in data else "" },
112112 timeout = self .timeout ,
113- follow_redirects = True
113+ follow_redirects = True ,
114114 )
115115 response .raise_for_status ()
116- logging .debug (f"{ self .name } - Client message sent successfully: { response .status_code } " )
116+ if not response .is_success :
117+ raise ValueError (f"{ self .name } - MCP Server response: { response .status_code } { response .reason_phrase } " )
117118 if "id" in data :
118119 message_id = data ["id" ]
119120 while True :
@@ -233,8 +234,10 @@ def send_message(self, data: dict):
233234 json = data ,
234235 headers = headers ,
235236 timeout = self .timeout ,
236- follow_redirects = True
237+ follow_redirects = True ,
237238 )
239+ if not response .is_success :
240+ raise ValueError (f"{ self .name } - MCP Server response: { response .status_code } { response .reason_phrase } " )
238241 self .session_id = response .headers .get ("mcp-session-id" , None )
239242 content_type = response .headers .get ("content-type" , "None" )
240243 if content_type == "text/event-stream" :
You can’t perform that action at this time.
0 commit comments