fix: do not omitempty ReadOnlyHint in ToolAnnotations#908
Conversation
ReadOnlyHint is a bare bool with omitempty, so the zero value (false) is indistinguishable from unset and drops out of marshaled JSON. Consumers that explicitly set ReadOnlyHint: false on write tools lose the field on the wire. Removing omitempty ensures false is always serialized, which matches the MCP spec default. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I would also suggest adding a new point to |
|
Thanks for the review and suggestions @maciej-kisiel @guglielmo-san. Updated the branch 👍 |
|
One last thing: I believe this is a behavior change that may result for example in breaking tests of our users. Given that, I would introduce a |
|
Great call @maciej-kisiel , implemented compatibility mechanism according to |
|
Please fix the staticcheck error. |
|
Thank you, team 🙌 |
ReadOnlyHintis aboolwith omitempty, so the zero value (false) is indistinguishable from unset, and drops out of marshaled JSON.The current behavior causes an issue with the OpenAI MCP app submission because they require explicit hints.
Consumers that explicitly set
ReadOnlyHint: falseon write tools lose the field on the wire. Removingomitemptyensuresfalseis always serialized, which matches the MCP spec default.