File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -271,3 +271,28 @@ def test_request_body_handling(complex_fastapi_app: FastAPI):
271
271
assert "create_order" in operation_map
272
272
assert operation_map ["create_order" ]["path" ] == "/orders"
273
273
assert operation_map ["create_order" ]["method" ] == "post"
274
+
275
+
276
+ def test_missing_type_handling (complex_fastapi_app : FastAPI ):
277
+ openapi_schema = get_openapi (
278
+ title = complex_fastapi_app .title ,
279
+ version = complex_fastapi_app .version ,
280
+ openapi_version = complex_fastapi_app .openapi_version ,
281
+ description = complex_fastapi_app .description ,
282
+ routes = complex_fastapi_app .routes ,
283
+ )
284
+
285
+ # Remove the type field from the product_id schema
286
+ params = openapi_schema ["paths" ]["/products/{product_id}" ]["get" ]["parameters" ]
287
+ for param in params :
288
+ if param .get ("name" ) == "product_id" and "schema" in param :
289
+ param ["schema" ].pop ("type" , None )
290
+ break
291
+
292
+ tools , operation_map = convert_openapi_to_mcp_tools (openapi_schema )
293
+
294
+ get_product_tool = next (tool for tool in tools if tool .name == "get_product" )
295
+ get_product_props = get_product_tool .inputSchema ["properties" ]
296
+
297
+ assert "product_id" in get_product_props
298
+ assert get_product_props ["product_id" ].get ("type" ) == "string" # Default type applied
You can’t perform that action at this time.
0 commit comments