Skip to content

OpenAI Agents SDK calls OpenAI API with invalid schema when MCP tool definitions have no properties field #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nikhil-pandey opened this issue Apr 7, 2025 · 0 comments · Fixed by #454
Labels
bug Something isn't working

Comments

@nikhil-pandey
Copy link

nikhil-pandey commented Apr 7, 2025

Describe the bug

When using the OpenAI Agents SDK with an MCP-compatible server, defining a tool without the properties field in the inputSchema causes the SDK to invoke OpenAI's API with invalid parameters, resulting in a schema validation error from the API.

OpenAI's API expects the properties field to be present, whereas the MCP schema explicitly allows omitting the properties field. MCP Spec

Image

The SDK should bridge this gap by adding an empty properties object {} if not provided.

Debug information

  • Agents SDK version: 0.0.8
  • Python version: 3.13.2

Repro steps

Create an MCP server tool definition without a properties field, for example:

{
  "name": "say_hello",
  "description": "Say hello to the client",
  "inputSchema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "EmptyObject",
    "type": "object"
  }
}

Call this tool via the OpenAI Agents SDK, causing the following error from OpenAI's API:

{
  "error": "Error code: 400 - {'error': {'message': \"Invalid schema for function 'say_hello': In context=(), object schema missing properties.\", 'type': 'invalid_request_error', 'param': 'tools[0].parameters', 'code': 'invalid_function_parameters'}}"
}

Expected behavior

The SDK should automatically inject an empty properties object {} in the OpenAI API call to remain compatible with OpenAI's expected schema, bridging the difference between the MCP schema and OpenAI's API requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant