@@ -253,7 +253,6 @@ async def send_request(
253253
254254 try :
255255 jsonrpc_request = JSONRPCRequest (
256- jsonrpc = "2.0" ,
257256 id = request_id ,
258257 ** request_data ,
259258 )
@@ -305,7 +304,6 @@ async def send_notification(
305304 # Some transport implementations may need to set the related_request_id
306305 # to attribute to the notifications to the request that triggered them.
307306 jsonrpc_notification = JSONRPCNotification (
308- jsonrpc = "2.0" ,
309307 ** notification .model_dump (by_alias = True , mode = "json" , exclude_none = True ),
310308 )
311309 session_message = SessionMessage (
@@ -316,12 +314,11 @@ async def send_notification(
316314
317315 async def _send_response (self , request_id : RequestId , response : SendResultT | ErrorData ) -> None :
318316 if isinstance (response , ErrorData ):
319- jsonrpc_error = JSONRPCError (jsonrpc = "2.0" , id = request_id , error = response )
317+ jsonrpc_error = JSONRPCError (id = request_id , error = response )
320318 session_message = SessionMessage (message = JSONRPCMessage (jsonrpc_error ))
321319 await self ._write_stream .send (session_message )
322320 else :
323321 jsonrpc_response = JSONRPCResponse (
324- jsonrpc = "2.0" ,
325322 id = request_id ,
326323 result = response .model_dump (by_alias = True , mode = "json" , exclude_none = True ),
327324 )
@@ -363,7 +360,6 @@ async def _receive_loop(self) -> None:
363360 logging .warning (f"Failed to validate request: { e } " )
364361 logging .debug (f"Message that failed validation: { message .message .root } " )
365362 error_response = JSONRPCError (
366- jsonrpc = "2.0" ,
367363 id = message .message .root .id ,
368364 error = ErrorData (
369365 code = INVALID_PARAMS ,
@@ -428,7 +424,7 @@ async def _receive_loop(self) -> None:
428424 for id , stream in self ._response_streams .items ():
429425 error = ErrorData (code = CONNECTION_CLOSED , message = "Connection closed" )
430426 try :
431- await stream .send (JSONRPCError (jsonrpc = "2.0" , id = id , error = error ))
427+ await stream .send (JSONRPCError (id = id , error = error ))
432428 await stream .aclose ()
433429 except Exception :
434430 # Stream might already be closed
0 commit comments