Skip to content

Carry JSON Schema type for optional tool fields - #8248

Closed
Ege (ege-arhan) wants to merge 1 commit into
microsoft:mainfrom
ege-arhan:fix-6848-gemini-optional-schema
Closed

Ege (ege-arhan) wants to merge 1 commit into
microsoft:mainfrom
ege-arhan:fix-6848-gemini-optional-schema

Conversation

@ege-arhan

Copy link
Copy Markdown

Ran into this while looking at #6848 — optional tool args like country: Optional[str] = None come out of BaseTool.schema without a top-level type, just anyOf. Some providers (Gemini in that report) reject the declaration because a property has no type field.

This just copies the non-null branch's type up when there's exactly one, so anyOf stays untouched and everything else renders the same as before.

Checked test_tools.py locally, 39 passed.

@ege-arhan

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@ege-arhan
Ege (ege-arhan) force-pushed the fix-6848-gemini-optional-schema branch from 030f566 to 32bc629 Compare October 22, 2026 23:32
@ege-arhan Ege (ege-arhan) closed this by deleting the head repository Oct 24, 2026
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.

1 participant