@@ -253,7 +253,6 @@ async def send_request(
253
253
254
254
try :
255
255
jsonrpc_request = JSONRPCRequest (
256
- jsonrpc = "2.0" ,
257
256
id = request_id ,
258
257
** request_data ,
259
258
)
@@ -305,7 +304,6 @@ async def send_notification(
305
304
# Some transport implementations may need to set the related_request_id
306
305
# to attribute to the notifications to the request that triggered them.
307
306
jsonrpc_notification = JSONRPCNotification (
308
- jsonrpc = "2.0" ,
309
307
** notification .model_dump (by_alias = True , mode = "json" , exclude_none = True ),
310
308
)
311
309
session_message = SessionMessage (
@@ -316,12 +314,11 @@ async def send_notification(
316
314
317
315
async def _send_response (self , request_id : RequestId , response : SendResultT | ErrorData ) -> None :
318
316
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 )
320
318
session_message = SessionMessage (message = JSONRPCMessage (jsonrpc_error ))
321
319
await self ._write_stream .send (session_message )
322
320
else :
323
321
jsonrpc_response = JSONRPCResponse (
324
- jsonrpc = "2.0" ,
325
322
id = request_id ,
326
323
result = response .model_dump (by_alias = True , mode = "json" , exclude_none = True ),
327
324
)
@@ -363,7 +360,6 @@ async def _receive_loop(self) -> None:
363
360
logging .warning (f"Failed to validate request: { e } " )
364
361
logging .debug (f"Message that failed validation: { message .message .root } " )
365
362
error_response = JSONRPCError (
366
- jsonrpc = "2.0" ,
367
363
id = message .message .root .id ,
368
364
error = ErrorData (
369
365
code = INVALID_PARAMS ,
@@ -428,7 +424,7 @@ async def _receive_loop(self) -> None:
428
424
for id , stream in self ._response_streams .items ():
429
425
error = ErrorData (code = CONNECTION_CLOSED , message = "Connection closed" )
430
426
try :
431
- await stream .send (JSONRPCError (jsonrpc = "2.0" , id = id , error = error ))
427
+ await stream .send (JSONRPCError (id = id , error = error ))
432
428
await stream .aclose ()
433
429
except Exception :
434
430
# Stream might already be closed
0 commit comments