Description
Description
When trying to use a Pydantic response_model with the agent if you set structured_output to True, or leave it off (it will default to true with a response_model) you will get schema error about in my case is the sequentialthinking MCP tool like so:
openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for function 'sequentialthinking': In context=(), 'additionalProperties' is required to be supplied and to be false.", 'type': 'invalid_request_error', 'param': 'tools[10].function.parameters', 'code': 'invalid_function_parameters'}}
Steps to Reproduce
Create an agent with MCP tools, in this case sequentialthinking is easy enough, and then set a response_model.
NOTE: If you set json_mode on it will disabled structured_output for the agent and it works and the pydantic model gets hydrated by the agent.
Agent Configuration (if applicable)
Provide relevant agent configuration. async with MCPTools(f"npx @modelcontextprotocol/server-sequential-thinking") as mcp_tools:
agent = Agent(
model=OpenAIChat(id="gpt-4.1-mini"),
storage=SqliteStorage(table_name="heinz_agent"),
tools=[LinearTools(),GithubTools(),mcp_tools,ThinkingTools()],
reasoning_model=OpenAIChat(id="o3-mini", reasoning_effort="high"),
response_model=CreateTicketPayload,
debug_mode=True
)