Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: GPT agent chats reject zero-argument MCP tools with properties: null #27252

Description

@slowshi

Is there an existing issue for this?

  • I have searched the existing issues.

Current Behavior

Coder Agent chats using an OpenAI/GPT-backed model fail before tool execution when an MCP server exposes a zero-argument tool.

The tool used to reproduce this is Tidewave's get_ecto_schemas. Its MCP schema is valid and includes an explicit empty object:

{
  "type": "object",
  "properties": {}
}

In a GPT-backed Coder chat, attempting to use that tool fails with HTTP 400. In a Sonnet-backed chat connected to the same workspace and MCP endpoint, the tool executes successfully and returns the expected schema list. MCP tools with non-empty parameter schemas also work on both providers.

This appears to be the object-valued counterpart of #23538: an empty or nil properties map reaches the OpenAI function schema as "properties": null rather than "properties": {}. The current MCP wrapper passes tool.InputSchema.Properties through as fantasy.ToolInfo.Parameters; that path likely needs the same defensive normalization previously added for required.

Relevant Log Output

OpenAI returned an unexpected error.
Invalid schema for function 'tidewave__get_ecto_schemas': None is not of type 'object'.
HTTP 400

Expected Behavior

Parameter-free MCP tools should be accepted by OpenAI-backed chats. Coder should preserve or normalize their function parameter schema to an explicit empty object, for example:

{
  "type": "object",
  "properties": {},
  "required": []
}

At the provider boundary, object schemas with missing, nil, or null properties should likewise be normalized to {}.

Steps to Reproduce

  1. Configure a Streamable HTTP MCP server in Coder that exposes a zero-argument tool with inputSchema: {"type":"object","properties":{}}.
  2. Create a Coder Agent chat using an OpenAI/GPT-backed model.
  3. Ask the agent to invoke the zero-argument tool.
  4. Observe the OpenAI HTTP 400 before the MCP tool executes.
  5. Switch to a Sonnet-backed model and invoke the same tool; it succeeds.

Environment

  • Host OS: self-hosted Linux deployment
  • Coder server: v2.35.2+5c2838a
  • Coder client: v2.33.1+3e34ba7
  • MCP transport: Streamable HTTP
  • Affected provider: OpenAI/GPT
  • Unaffected provider: Anthropic/Sonnet
  • Reproduces consistently: yes

Additional Context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions