Skip to content

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

Closed
@nikhil-pandey

Description

@nikhil-pandey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions