18
18
import logging
19
19
from abc import ABC
20
20
from abc import abstractmethod
21
- from contextlib import AsyncContextManager
21
+ from collections .abc import Callable
22
+ from contextlib import AbstractAsyncContextManager
22
23
from contextlib import asynccontextmanager
23
24
from enum import Enum
24
25
from typing import Any
@@ -101,7 +102,7 @@ def __init__(self, client_type: str = 'sse'):
101
102
102
103
@abstractmethod
103
104
@asynccontextmanager
104
- async def connect_to_server (self ) -> AsyncContextManager [ ClientSession ] :
105
+ async def connect_to_server (self ):
105
106
"""
106
107
Establish a session with an MCP server within an async context
107
108
"""
@@ -119,7 +120,7 @@ async def get_tools(self):
119
120
MCPToolClient (connect_fn = self .connect_to_server ,
120
121
tool_name = tool .name ,
121
122
tool_description = tool .description ,
122
- tool_input_schema = tool .input_schema )
123
+ tool_input_schema = tool .inputSchema )
123
124
for tool in response .tools
124
125
}
125
126
@@ -164,7 +165,7 @@ def __init__(self, url: str, client_type: str = 'sse'):
164
165
self ._url = url
165
166
166
167
@asynccontextmanager
167
- async def connect_to_server (self ) -> AsyncContextManager [ ClientSession ] :
168
+ async def connect_to_server (self ):
168
169
"""
169
170
Establish a session with an MCP SSE server within an async context
170
171
"""
@@ -215,7 +216,7 @@ async def stop_persistent_session(self):
215
216
self ._session_cm = None
216
217
217
218
@asynccontextmanager
218
- async def connect_to_server (self ) -> AsyncContextManager [ ClientSession ] :
219
+ async def connect_to_server (self ):
219
220
"""
220
221
Establish a session with an MCP server via stdio within an async context
221
222
"""
@@ -241,7 +242,7 @@ class MCPToolClient:
241
242
"""
242
243
243
244
def __init__ (self ,
244
- connect_fn : callable [[], AsyncContextManager [ClientSession ]],
245
+ connect_fn : Callable [[], AbstractAsyncContextManager [ClientSession ]],
245
246
tool_name : str ,
246
247
tool_description : str | None ,
247
248
tool_input_schema : dict | None = None ):
0 commit comments