Skip to content

fix(openai): support Notion and Jira MCP tools with gpt-5 strict mode#2839

Merged
dgageot merged 4 commits into
docker:mainfrom
dgageot:board/9e62b5d9a4028eec
May 21, 2026
Merged

fix(openai): support Notion and Jira MCP tools with gpt-5 strict mode#2839
dgageot merged 4 commits into
docker:mainfrom
dgageot:board/9e62b5d9a4028eec

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented May 20, 2026

Problem

OpenAI's Responses API in strict mode (used by gpt-5/gpt-5.5 with Strict: true) requires additionalProperties to be literally false on every object schema. Some MCP servers ship tool schemas that violate this:

  • Atlassian remote MCP (editJiraIssue): declares fields.additionalProperties: {} (or a richer schema). The request fails with:

    HTTP 400: Invalid schema for function 'atlassian-remote_editJiraIssue':
    In context=('properties', 'fields', 'additionalProperties'),
    'additionalProperties' is required to be supplied and to be false.
    
  • Notion MCP (e.g. block-creation tools): declares additionalProperties as a schema (a map describing the dictionary value shape, like bulleted_list_item/numbered_list_item). Rewriting that to false would strip information the model relies on to call the tool correctly.

A previous fix overwrote schema-form additionalProperties with false everywhere — that fixed Jira but degraded Notion's tool calls.

Fix

Decide strict mode per tool:

  1. ConvertParametersToSchema now returns (schema, strict, err).
  2. A schema is strict-incompatible if any node has additionalProperties set to a map (schema form) or to true. We detect that with a read-only walk before any normalization.
  3. Strict-compatible schemas go through the existing pipeline (makeAllRequired → forces additionalProperties: false, all properties required, nullables, etc.).
  4. Strict-incompatible schemas are preserved (only cosmetic fixups: ensureTypeFields, removeFormatFields, fixSchemaArrayItems).
  5. The Responses API tool definition uses Strict: param.NewOpt(strict) per tool.

Result:

  • Jira's editJiraIssue works because we no longer claim strict mode on it.
  • Notion's tools work because the inner dictionary schema survives the conversion.
  • All other tools keep the existing strict-mode benefits.

Tests

  • TestIsStrictCompatible covers strict, additionalProperties: true, and schema-form cases.
  • TestConvertParametersToSchema_NotionStylePreservesShape proves Notion's inner schema is preserved end-to-end.
  • TestMakeAllRequired_JiraEditIssueFields is a regression for the original Atlassian failure.
  • All existing schema/conversion tests updated to the new 3-return signature.

Validation

  • `go build ./...` ✅
  • `go vet ./...` ✅
  • `go test -race -count=1 ./pkg/model/provider/...` ✅
  • `task lint` ✅ (0 issues)
  • `go mod tidy --diff` clean ✅

@dgageot dgageot requested a review from a team as a code owner May 20, 2026 14:35
docker-agent

This comment was marked as outdated.

docker-agent

This comment was marked as outdated.

dgageot added a commit to dgageot/cagent that referenced this pull request May 20, 2026
… Responses API

Address review feedback on PR docker#2839:

- Restore unconditional makeAllRequired so Chat Completions API tools
  (gpt-4o, etc.) keep receiving fully-populated required arrays even
  when the schema is strict-incompatible (Notion / Jira). The previous
  refactor inadvertently skipped normalization for those tools.
- makeAllRequired preserves schema-form additionalProperties (Notion's
  dictionary value shape) and only forces missing/true/nil values to
  false, so Jira's editJiraIssue and Notion block tools keep working.
- isStrictCompatible now short-circuits at the first incompatible
  node instead of walking the full schema tree.
- Tests updated to reflect that schema-form additionalProperties is
  preserved end-to-end while the inner schema is still normalized.
aheritier

This comment was marked as outdated.

dgageot added a commit to dgageot/cagent that referenced this pull request May 20, 2026
… Responses API

Address review feedback on PR docker#2839:

- Restore unconditional makeAllRequired so Chat Completions API tools
  (gpt-4o, etc.) keep receiving fully-populated required arrays even
  when the schema is strict-incompatible (Notion / Jira). The previous
  refactor inadvertently skipped normalization for those tools.
- makeAllRequired preserves schema-form additionalProperties (Notion's
  dictionary value shape) and only forces missing/true/nil values to
  false, so Jira's editJiraIssue and Notion block tools keep working.
- isStrictCompatible now short-circuits at the first incompatible
  node instead of walking the full schema tree.
- Tests updated to reflect that schema-form additionalProperties is
  preserved end-to-end while the inner schema is still normalized.
@dgageot dgageot force-pushed the board/9e62b5d9a4028eec branch from c1b7e83 to 0f2aee6 Compare May 20, 2026 16:28
@dgageot dgageot requested a review from aheritier May 20, 2026 16:48
docker-agent

This comment was marked as outdated.

dgageot added a commit to dgageot/cagent that referenced this pull request May 21, 2026
… Responses API

Address review feedback on PR docker#2839:

- Restore unconditional makeAllRequired so Chat Completions API tools
  (gpt-4o, etc.) keep receiving fully-populated required arrays even
  when the schema is strict-incompatible (Notion / Jira). The previous
  refactor inadvertently skipped normalization for those tools.
- makeAllRequired preserves schema-form additionalProperties (Notion's
  dictionary value shape) and only forces missing/true/nil values to
  false, so Jira's editJiraIssue and Notion block tools keep working.
- isStrictCompatible now short-circuits at the first incompatible
  node instead of walking the full schema tree.
- Tests updated to reflect that schema-form additionalProperties is
  preserved end-to-end while the inner schema is still normalized.
@dgageot dgageot force-pushed the board/9e62b5d9a4028eec branch from 80e0250 to d8374fd Compare May 21, 2026 05:53
dgageot added 4 commits May 21, 2026 10:49
… Responses API

Address review feedback on PR docker#2839:

- Restore unconditional makeAllRequired so Chat Completions API tools
  (gpt-4o, etc.) keep receiving fully-populated required arrays even
  when the schema is strict-incompatible (Notion / Jira). The previous
  refactor inadvertently skipped normalization for those tools.
- makeAllRequired preserves schema-form additionalProperties (Notion's
  dictionary value shape) and only forces missing/true/nil values to
  false, so Jira's editJiraIssue and Notion block tools keep working.
- isStrictCompatible now short-circuits at the first incompatible
  node instead of walking the full schema tree.
- Tests updated to reflect that schema-form additionalProperties is
  preserved end-to-end while the inner schema is still normalized.
- Document that the strict-mode decision is per-tool and all-or-nothing
  on isStrictCompatible.
- Rename TestMakeAllRequired_JiraEditIssueFields to
  TestConvertParametersToSchema_JiraEditIssueFields to track the SUT.
…walk

- Walk prefixItems sub-schemas in both hasIncompatibleNode and walkSchema
  so tuple-typed schemas with schema-form additionalProperties are detected
  and normalized.
- Remove the unreachable second additionalProperties map check in
  hasIncompatibleNode: the type switch at the top already returns true
  for any map[string]any value.
- Add a strict-incompatibility regression test for prefixItems.
@dgageot dgageot force-pushed the board/9e62b5d9a4028eec branch from d8374fd to f0aeef9 Compare May 21, 2026 08:51
@dgageot dgageot merged commit 1b85603 into docker:main May 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants