55
66from mcp import types
77from mcp .client .session import ClientSession
8- from mcp .server import Server , ServerRequestContext
8+ from mcp .server import Server
99from mcp .server .lowlevel import NotificationOptions
1010from mcp .server .models import InitializationOptions
1111from mcp .server .session import ServerSession
@@ -39,9 +39,7 @@ async def run_server():
3939 InitializationOptions (
4040 server_name = "ListChangedServer" ,
4141 server_version = "0.1.0" ,
42- capabilities = server .get_capabilities (
43- NotificationOptions (tools_changed = True ), {}
44- ),
42+ capabilities = server .get_capabilities (NotificationOptions (tools_changed = True ), {}),
4543 ),
4644 ) as server_session :
4745 async for message in server_session .incoming_messages :
@@ -61,9 +59,7 @@ async def run_server():
6159 SessionMessage (
6260 message = types .JSONRPCNotification (
6361 jsonrpc = "2.0" ,
64- ** types .ToolListChangedNotification ().model_dump (
65- by_alias = True , mode = "json" , exclude_none = True
66- ),
62+ ** types .ToolListChangedNotification ().model_dump (by_alias = True , mode = "json" , exclude_none = True ),
6763 ),
6864 )
6965 )
@@ -95,9 +91,7 @@ async def run_server():
9591 InitializationOptions (
9692 server_name = "ListChangedServer" ,
9793 server_version = "0.1.0" ,
98- capabilities = server .get_capabilities (
99- NotificationOptions (prompts_changed = True ), {}
100- ),
94+ capabilities = server .get_capabilities (NotificationOptions (prompts_changed = True ), {}),
10195 ),
10296 ) as server_session :
10397 async for message in server_session .incoming_messages :
@@ -150,9 +144,7 @@ async def run_server():
150144 InitializationOptions (
151145 server_name = "ListChangedServer" ,
152146 server_version = "0.1.0" ,
153- capabilities = server .get_capabilities (
154- NotificationOptions (resources_changed = True ), {}
155- ),
147+ capabilities = server .get_capabilities (NotificationOptions (resources_changed = True ), {}),
156148 ),
157149 ) as server_session :
158150 async for message in server_session .incoming_messages :
@@ -225,9 +217,7 @@ async def run_server():
225217 SessionMessage (
226218 message = types .JSONRPCNotification (
227219 jsonrpc = "2.0" ,
228- ** notification_cls ().model_dump (
229- by_alias = True , mode = "json" , exclude_none = True
230- ),
220+ ** notification_cls ().model_dump (by_alias = True , mode = "json" , exclude_none = True ),
231221 ),
232222 )
233223 )
@@ -278,9 +268,7 @@ async def run_server():
278268 SessionMessage (
279269 message = types .JSONRPCNotification (
280270 jsonrpc = "2.0" ,
281- ** types .ToolListChangedNotification ().model_dump (
282- by_alias = True , mode = "json" , exclude_none = True
283- ),
271+ ** types .ToolListChangedNotification ().model_dump (by_alias = True , mode = "json" , exclude_none = True ),
284272 ),
285273 )
286274 )
0 commit comments