@@ -309,6 +309,17 @@ def func_typing_dict() -> typing.Dict[str, str]: # noqa: UP006
309309 assert isinstance (result , CallToolResult )
310310 assert result .structured_content == {"name" : "John" }
311311
312+ # Test bare typing.Dict (unparameterized) - should match bare dict behavior without wrapping
313+ def func_bare_typing_dict () -> typing .Dict : # noqa: UP006
314+ return {"msg" : "hello" , "code" : 200 }
315+
316+ meta_bare = func_metadata (func_bare_typing_dict )
317+ assert meta_bare .output_schema == IsPartialDict (type = "object" )
318+ assert not meta_bare .wrap_output
319+ result_bare = meta_bare .convert_result (func_bare_typing_dict ())
320+ assert isinstance (result_bare , CallToolResult )
321+ assert result_bare .structured_content == {"msg" : "hello" , "code" : 200 }
322+
312323 # Test dict[int, str] - should be wrapped since key is not str
313324 def func_dict_int_key () -> dict [int , str ]: # pragma: no cover
314325 return {1 : "a" , 2 : "b" }
@@ -318,6 +329,31 @@ def func_dict_int_key() -> dict[int, str]: # pragma: no cover
318329 assert "result" in meta .output_schema ["properties" ]
319330
320331
332+ def test_bare_typing_sequence_opts_out_of_structured_output ():
333+ """Test that bare typing.List and typing.Tuple opt out of structured output like bare list/tuple."""
334+ def func_bare_list () -> list :
335+ return ["a" , "b" ]
336+
337+ def func_bare_typing_list () -> typing .List : # noqa: UP006
338+ return ["a" , "b" ]
339+
340+ def func_bare_tuple () -> tuple :
341+ return ("a" , "b" )
342+
343+ def func_bare_typing_tuple () -> typing .Tuple : # noqa: UP006
344+ return ("a" , "b" )
345+
346+ meta_list = func_metadata (func_bare_list )
347+ meta_typing_list = func_metadata (func_bare_typing_list )
348+ meta_tuple = func_metadata (func_bare_tuple )
349+ meta_typing_tuple = func_metadata (func_bare_typing_tuple )
350+
351+ assert meta_list .output_schema is None
352+ assert meta_typing_list .output_schema is None
353+ assert meta_tuple .output_schema is None
354+ assert meta_typing_tuple .output_schema is None
355+
356+
321357@pytest .mark .anyio
322358async def test_lambda_function ():
323359 """Test lambda function schema and validation"""
0 commit comments