fix(openai): support Notion and Jira MCP tools with gpt-5 strict mode#2839
Merged
Conversation
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
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.
c1b7e83 to
0f2aee6
Compare
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.
80e0250 to
d8374fd
Compare
… 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.
d8374fd to
f0aeef9
Compare
aheritier
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenAI's Responses API in strict mode (used by gpt-5/gpt-5.5 with
Strict: true) requiresadditionalPropertiesto be literallyfalseon every object schema. Some MCP servers ship tool schemas that violate this:Atlassian remote MCP (
editJiraIssue): declaresfields.additionalProperties: {}(or a richer schema). The request fails with:Notion MCP (e.g. block-creation tools): declares
additionalPropertiesas a schema (a map describing the dictionary value shape, likebulleted_list_item/numbered_list_item). Rewriting that tofalsewould strip information the model relies on to call the tool correctly.A previous fix overwrote schema-form
additionalPropertieswithfalseeverywhere — that fixed Jira but degraded Notion's tool calls.Fix
Decide strict mode per tool:
ConvertParametersToSchemanow returns(schema, strict, err).additionalPropertiesset to a map (schema form) or totrue. We detect that with a read-only walk before any normalization.makeAllRequired→ forcesadditionalProperties: false, all properties required, nullables, etc.).ensureTypeFields,removeFormatFields,fixSchemaArrayItems).Strict: param.NewOpt(strict)per tool.Result:
editJiraIssueworks because we no longer claim strict mode on it.Tests
TestIsStrictCompatiblecovers strict,additionalProperties: true, and schema-form cases.TestConvertParametersToSchema_NotionStylePreservesShapeproves Notion's inner schema is preserved end-to-end.TestMakeAllRequired_JiraEditIssueFieldsis a regression for the original Atlassian failure.Validation