Skip to content

MCP: accept null for arguments whose default is None - #648

Merged
saleh-mir merged 1 commit into
masterfrom
fix/mcp-null-optional-arguments
Nov 6, 2026
Merged

saleh-mir merged 1 commit into
masterfrom
fix/mcp-null-optional-arguments

Conversation

@saleh-mir

Copy link
Copy Markdown
Member

Optional tool arguments advertise "default": null, but a bare str/int annotation rejected an explicit null, so clients that send every optional field with its schema default failed. An explicit null is now dropped before validation, which is exactly the omitted behavior. JSON-text arguments such as strategy_codes stay text.

Arguments rejecting null: 100 before, 0 after. Fixes #632. Test: tests/test_mcp_null_arguments.py.

🤖 Generated with Claude Code

Optional arguments advertise "default": null, but a bare str or int
annotation rejected that null, so clients that send every optional field with
its schema default failed. An explicit null is now dropped before validation,
which is exactly the omitted behavior. JSON-text arguments such as
strategy_codes stay text. Fixes #632.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@saleh-mir
saleh-mir force-pushed the fix/mcp-null-optional-arguments branch from 139e078 to ec254ae Compare November 6, 2026 17:58
@saleh-mir
saleh-mir merged commit decaf40 into master Nov 6, 2026
15 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.

MCP: 52 optional tool arguments advertise "default": null but reject null

1 participant