Skip to content

Commit e46c693

Browse files
committed
updates from ruff format
1 parent 92f806b commit e46c693

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

src/mcp/client/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ async def initialize(self) -> types.InitializeResult:
140140
)
141141
),
142142
types.InitializeResult,
143-
cancellable=False
143+
cancellable=False,
144144
)
145145

146146
if result.protocolVersion not in SUPPORTED_PROTOCOL_VERSIONS:

src/mcp/server/lowlevel/server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,15 +448,13 @@ def decorator(
448448
logger.debug("Registering handler for CancelledNotification")
449449

450450
async def handler(req: types.CancelledNotification):
451-
await func(
452-
req.params.requestId, req.params.reason
453-
)
451+
await func(req.params.requestId, req.params.reason)
454452

455453
self.notification_handlers[types.CancelledNotification] = handler
456454
return func
457455

458456
return decorator
459-
457+
460458
def completion(self):
461459
"""Provides completions for prompts and resource templates"""
462460

src/mcp/shared/session.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
SendResultT = TypeVar("SendResultT", ClientResult, ServerResult)
3636
SendNotificationT = TypeVar("SendNotificationT", ClientNotification, ServerNotification)
3737
SendNotificationInternalT = TypeVar(
38-
"SendNotificationInternalT",
39-
CancelledNotification, ClientNotification, ServerNotification
38+
"SendNotificationInternalT",
39+
CancelledNotification,
40+
ClientNotification,
41+
ServerNotification,
4042
)
4143
ReceiveRequestT = TypeVar("ReceiveRequestT", ClientRequest, ServerRequest)
4244
ReceiveResultT = TypeVar("ReceiveResultT", bound=BaseModel)
@@ -269,14 +271,13 @@ async def send_request(
269271
notification = CancelledNotification(
270272
method="notifications/cancelled",
271273
params=CancelledNotificationParams(
272-
requestId=request_id,
273-
reason="cancelled"
274-
)
274+
requestId=request_id, reason="cancelled"
275+
),
275276
)
276277
await self._send_notification_internal(
277278
notification, request_id
278279
)
279-
280+
280281
raise McpError(
281282
ErrorData(code=32601, message="Request cancelled")
282283
)
@@ -292,7 +293,7 @@ async def send_request(
292293
),
293294
)
294295
)
295-
296+
296297
if isinstance(response_or_error, JSONRPCError):
297298
raise McpError(response_or_error.error)
298299
else:

tests/shared/test_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list:
6262
await anyio.sleep(10) # Long enough to ensure we can cancel
6363
return []
6464
raise ValueError(f"Unknown tool: {name}")
65-
65+
6666
@server.cancel_notification()
6767
async def handle_cancel(requestId: str | int, reason: str | None):
6868
nonlocal ev_cancel_notified

0 commit comments

Comments
 (0)