@@ -158,42 +158,30 @@ class TestFastMCPToolsetInitialization:
158158
159159 async def test_init_with_client (self , fastmcp_client : Client [FastMCPTransport ]):
160160 """Test initialization with a FastMCP client."""
161- toolset = FastMCPToolset (client = fastmcp_client )
161+ toolset = FastMCPToolset (fastmcp_client )
162162
163163 # Test that the client is accessible via the property
164164 assert toolset .id is None
165165
166166 async def test_init_with_id (self , fastmcp_client : Client [FastMCPTransport ]):
167167 """Test initialization with an id."""
168- toolset = FastMCPToolset (client = fastmcp_client , id = 'test_id' )
168+ toolset = FastMCPToolset (fastmcp_client , id = 'test_id' )
169169
170170 # Test that the client is accessible via the property
171171 assert toolset .id == 'test_id'
172172
173173 async def test_init_with_custom_retries_and_error_behavior (self , fastmcp_client : Client [FastMCPTransport ]):
174174 """Test initialization with custom retries and error behavior."""
175- toolset = FastMCPToolset (client = fastmcp_client , max_retries = 5 , tool_error_behavior = 'model_retry' )
175+ toolset = FastMCPToolset (fastmcp_client , max_retries = 5 , tool_error_behavior = 'model_retry' )
176176
177177 # Test that the toolset was created successfully
178178 assert toolset .client is fastmcp_client
179179
180180 async def test_id_property (self , fastmcp_client : Client [FastMCPTransport ]):
181181 """Test that the id property returns None."""
182- toolset = FastMCPToolset (client = fastmcp_client )
182+ toolset = FastMCPToolset (fastmcp_client )
183183 assert toolset .id is None
184184
185- async def test_init_without_client_or_transport (self ):
186- """Test initialization without a client or transport."""
187- with pytest .raises (ValueError , match = 'Either client or transport must be provided' ):
188- FastMCPToolset ()
189-
190- async def test_init_with_client_and_transport (self ):
191- """Test initialization with a client and transport."""
192- with pytest .raises (ValueError , match = 'Either client or transport must be provided, not both' ):
193- tmp_server = FastMCP ('tmp_server' )
194- client = Client (transport = tmp_server )
195- FastMCPToolset (client = client , transport = tmp_server ) # pyright: ignore[reportCallIssue]
196-
197185
198186class TestFastMCPToolsetContextManagement :
199187 """Test FastMCP Toolset context management."""
@@ -202,7 +190,7 @@ async def test_context_manager_single_enter_exit(
202190 self , fastmcp_client : Client [FastMCPTransport ], run_context : RunContext [None ]
203191 ):
204192 """Test single enter/exit cycle."""
205- toolset = FastMCPToolset (client = fastmcp_client )
193+ toolset = FastMCPToolset (fastmcp_client )
206194
207195 async with toolset :
208196 # Test that we can get tools when the context is active
@@ -216,7 +204,7 @@ async def test_context_manager_no_enter(
216204 self , fastmcp_client : Client [FastMCPTransport ], run_context : RunContext [None ]
217205 ):
218206 """Test no enter/exit cycle."""
219- toolset = FastMCPToolset (client = fastmcp_client )
207+ toolset = FastMCPToolset (fastmcp_client )
220208
221209 # Test that we can get tools when the context is not active
222210 tools = await toolset .get_tools (run_context )
@@ -227,7 +215,7 @@ async def test_context_manager_nested_enter_exit(
227215 self , fastmcp_client : Client [FastMCPTransport ], run_context : RunContext [None ]
228216 ):
229217 """Test nested enter/exit cycles."""
230- toolset = FastMCPToolset (client = fastmcp_client )
218+ toolset = FastMCPToolset (fastmcp_client )
231219
232220 async with toolset :
233221 tools1 = await toolset .get_tools (run_context )
@@ -248,7 +236,7 @@ async def test_get_tools(
248236 run_context : RunContext [None ],
249237 ):
250238 """Test getting tools from the FastMCP client."""
251- toolset = FastMCPToolset (client = fastmcp_client )
239+ toolset = FastMCPToolset (fastmcp_client )
252240
253241 async with toolset :
254242 tools = await toolset .get_tools (run_context )
@@ -275,7 +263,7 @@ async def test_get_tools(
275263 assert test_tool .tool_def .name == 'test_tool'
276264 assert test_tool .tool_def .description is not None
277265 assert 'test tool that returns a formatted string' in test_tool .tool_def .description
278- assert test_tool .max_retries == 2
266+ assert test_tool .max_retries == 1
279267 assert test_tool .toolset is toolset
280268
281269 # Check that the tool has proper schema
@@ -288,7 +276,7 @@ async def test_get_tools_with_empty_server(self, run_context: RunContext[None]):
288276 """Test getting tools from an empty FastMCP server."""
289277 empty_server = FastMCP ('empty_server' )
290278 empty_client = Client (transport = empty_server )
291- toolset = FastMCPToolset (client = empty_client )
279+ toolset = FastMCPToolset (empty_client )
292280
293281 async with toolset :
294282 tools = await toolset .get_tools (run_context )
@@ -301,7 +289,7 @@ class TestFastMCPToolsetToolCalling:
301289 @pytest .fixture
302290 async def fastmcp_toolset (self , fastmcp_client : Client [FastMCPTransport ]) -> FastMCPToolset [None ]:
303291 """Create a FastMCP Toolset."""
304- return FastMCPToolset (client = fastmcp_client )
292+ return FastMCPToolset (fastmcp_client )
305293
306294 async def test_call_tool_success (
307295 self ,
@@ -491,7 +479,7 @@ async def test_call_tool_with_error_behavior_raise(
491479 run_context : RunContext [None ],
492480 ):
493481 """Test tool call with error behavior set to raise."""
494- toolset = FastMCPToolset (client = fastmcp_client , tool_error_behavior = 'error' )
482+ toolset = FastMCPToolset (fastmcp_client , tool_error_behavior = 'error' )
495483
496484 async with toolset :
497485 tools = await toolset .get_tools (run_context )
@@ -506,7 +494,7 @@ async def test_call_tool_with_error_behavior_model_retry(
506494 run_context : RunContext [None ],
507495 ):
508496 """Test tool call with error behavior set to model retry."""
509- toolset = FastMCPToolset (client = fastmcp_client , tool_error_behavior = 'model_retry' )
497+ toolset = FastMCPToolset (fastmcp_client , tool_error_behavior = 'model_retry' )
510498
511499 async with toolset :
512500 tools = await toolset .get_tools (run_context )
@@ -577,7 +565,7 @@ async def test_transports(self):
577565 @pytest .mark .parametrize (
578566 'invalid_transport' , ['tomato_is_not_a_valid_transport' , '/path/to/server.ini' , 'ftp://localhost' ]
579567 )
580- async def test_invalid_transports_uninferrable (self , invalid_transport : str | None ):
568+ async def test_invalid_transports_uninferrable (self , invalid_transport : str ):
581569 """Test creating toolset from invalid transports."""
582570 with pytest .raises (ValueError , match = 'Could not infer a valid transport from:' ):
583571 FastMCPToolset (invalid_transport )
0 commit comments