@@ -202,11 +202,13 @@ def convert_openapi_to_mcp_tools(
202
202
param_desc = param .get ("description" , "" )
203
203
param_required = param .get ("required" , True ) # Path params are usually required
204
204
205
- properties [param_name ] = {
206
- "type" : param_schema .get ("type" , "string" ),
207
- "title" : param_name ,
208
- "description" : param_desc ,
209
- }
205
+ properties [param_name ] = param_schema .copy ()
206
+ properties [param_name ]["title" ] = param_name
207
+ if param_desc :
208
+ properties [param_name ]["description" ] = param_desc
209
+
210
+ if "type" not in properties [param_name ]:
211
+ properties [param_name ]["type" ] = param_schema .get ("type" , "string" )
210
212
211
213
if param_required :
212
214
required_props .append (param_name )
@@ -217,11 +219,14 @@ def convert_openapi_to_mcp_tools(
217
219
param_desc = param .get ("description" , "" )
218
220
param_required = param .get ("required" , False )
219
221
220
- properties [param_name ] = {
221
- "type" : get_single_param_type_from_schema (param_schema ),
222
- "title" : param_name ,
223
- "description" : param_desc ,
224
- }
222
+ properties [param_name ] = param_schema .copy ()
223
+ properties [param_name ]["title" ] = param_name
224
+ if param_desc :
225
+ properties [param_name ]["description" ] = param_desc
226
+
227
+ if "type" not in properties [param_name ]:
228
+ properties [param_name ]["type" ] = get_single_param_type_from_schema (param_schema )
229
+
225
230
if "default" in param_schema :
226
231
properties [param_name ]["default" ] = param_schema ["default" ]
227
232
@@ -233,10 +238,14 @@ def convert_openapi_to_mcp_tools(
233
238
param_schema = param .get ("schema" , {})
234
239
param_required = param .get ("required" , False )
235
240
236
- properties [param_name ] = {
237
- "type" : get_single_param_type_from_schema (param_schema ),
238
- "title" : param_name ,
239
- }
241
+ properties [param_name ] = param_schema .copy ()
242
+ properties [param_name ]["title" ] = param_name
243
+ if param_desc :
244
+ properties [param_name ]["description" ] = param_desc
245
+
246
+ if "type" not in properties [param_name ]:
247
+ properties [param_name ]["type" ] = get_single_param_type_from_schema (param_schema )
248
+
240
249
if "default" in param_schema :
241
250
properties [param_name ]["default" ] = param_schema ["default" ]
242
251
0 commit comments