Skip to content

fix: make all-optional tool args schemas compatible with OpenAI strict function calling#4467

Open
hanakokoizumi wants to merge 1 commit into
code-yeongyu:devfrom
hanakokoizumi:dev
Open

fix: make all-optional tool args schemas compatible with OpenAI strict function calling#4467
hanakokoizumi wants to merge 1 commit into
code-yeongyu:devfrom
hanakokoizumi:dev

Conversation

@hanakokoizumi

@hanakokoizumi hanakokoizumi commented May 25, 2026

Copy link
Copy Markdown

Summary

  • OpenAI-compatible providers (and proxies) reject MCP tool schemas where all parameters are optional, emitting a 500 error: "None is not of type 'array'" — the JSON Schema serializer outputs required: null instead of required: [] for such tools.
  • Promotes one semantically appropriate parameter to required in each of the 4 affected tools so the schema always has a valid required array.
  • Runtime behavior is fully preserved via fallback logic where needed.

Changes

  • background_cancel: all (boolean) promoted to required; moved before taskId. Callers must now explicitly pass all=false when cancelling by ID. Updated BackgroundCancelArgs interface to match.
  • session_list: limit promoted to required. Pass 0 to mean "no limit". Updated description and SessionListArgs interface to match.
  • team_create: leadSessionId promoted to required and moved first. Pass "" to use the current session. Added empty-string fallback in execute: (leadSessionId && leadSessionId.length > 0 ? leadSessionId : undefined) ?? runtimeContext.sessionID.
  • team_list: scope promoted to required. Callers must now pass "user", "project", or "all" explicitly. Removed ?? "all" fallback from execute since the value is always present.

Testing

Verified by running against an OpenAI-compatible proxy (new-api/gpt-5.5, github-copilot/gpt-5.2-codex) that previously rejected these tool schemas with the None is not of type 'array' error. All 4 tools now pass schema validation and execute correctly.


Summary by cubic

Fixes schema incompatibility with OpenAI strict function calling by ensuring tool arg schemas never have all-optional parameters. One parameter is now required in background_cancel, session_list, team_create, and team_list, while preserving runtime behavior via fallbacks.

  • Migration
    • background_cancel: all is required. Set true to cancel all tasks; set false and provide taskId to cancel one.
    • session_list: limit is required. Use 0 for no limit.
    • team_create: leadSessionId is required. Pass "" to use the current session.
    • team_list: scope is required. Pass user, project, or all.

Written for commit 40cb283. Summary will update on new commits. Review in cubic

@github-actions

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@hanakokoizumi

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@code-yeongyu code-yeongyu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can’t approve this while the PR still references forbidden deprecated GPT models and is DIRTY against current dev.

The PR body lists verification against github-copilot/gpt-5.2-codex. Repository policy now forbids GPT-5.2/GPT-5.3 usage and references; please update the verification note to a GPT-5.5-era model, rebase/merge current dev, and rerun the relevant tool-schema tests before requesting review again.

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.

2 participants