@@ -152,9 +152,13 @@ def optional_param_function(a: int, b: Optional[int] = None) -> str:
152
152
153
153
154
154
@pytest .mark .asyncio
155
- async def test_optional_param_function ():
155
+ async def test_non_strict_mode_function ():
156
156
tool = optional_param_function
157
157
158
+ assert tool .strict_json_schema is False , "strict_json_schema should be False"
159
+
160
+ assert tool .params_json_schema .get ("required" ) == ["a" ], "required should only be a"
161
+
158
162
input_data = {"a" : 5 }
159
163
output = await tool .on_invoke_tool (ctx_wrapper (), json .dumps (input_data ))
160
164
assert output == "5_no_b"
@@ -165,7 +169,7 @@ async def test_optional_param_function():
165
169
166
170
167
171
@function_tool (strict_mode = False )
168
- def multiple_optional_params_function (
172
+ def all_optional_params_function (
169
173
x : int = 42 ,
170
174
y : str = "hello" ,
171
175
z : Optional [int ] = None ,
@@ -176,8 +180,12 @@ def multiple_optional_params_function(
176
180
177
181
178
182
@pytest .mark .asyncio
179
- async def test_multiple_optional_params_function ():
180
- tool = multiple_optional_params_function
183
+ async def test_all_optional_params_function ():
184
+ tool = all_optional_params_function
185
+
186
+ assert tool .strict_json_schema is False , "strict_json_schema should be False"
187
+
188
+ assert tool .params_json_schema .get ("required" ) is None , "required should be empty"
181
189
182
190
input_data : dict [str , Any ] = {}
183
191
output = await tool .on_invoke_tool (ctx_wrapper (), json .dumps (input_data ))
0 commit comments