-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
When using the tool_use in openai api feature with a tool that has an array-type parameter, an error occurs during execution.
it seems that during the conversion from OpenAPI to JSON Schema, the items object associated with the array parameter is missing in the resulting schema. This causes the validation or tool execution to fail.
example
OpenAPI Schema
...
"/pet/findByTags": {
"get": {
"tags": ["pet"],
"summary": "Finds Pets by tags.",
"description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
"operationId": "findPetsByTags",
"parameters": [
{
"name": "tags",
"in": "query",
"description": "Tags to filter by",
"required": true,
"explode": true,
"schema": { "type": "array", "items": { "type": "string" } }
}
],
...
Generated mcp input schema (low-level mode)
{
"type": "object",
"properties": {
"tags": {
"type": "array",
"description": "Tags to filter by"
}
},
"required": [],
"additionalProperties": false
}
openai api cause error using mcp tools
openai.BadRequestError: Error code: 400 -
{
'error': {
'message': "Invalid schema for function 'get_pet_findByTags': In context=('properties', 'tags'), array schema missing items.",
'type': 'invalid_request_error',
'param': 'tools[0].parameters',
'code': 'invalid_function_parameters',
}
}
mike-zn-lin
Metadata
Metadata
Assignees
Labels
No labels