Repository navigation
Don't default ToolAnnotations members to false - #407
khushalsagar wants to merge 1 commit into
Conversation
ToolAnnotations members no longer have default values, so consumers can tell whether the author set a hint. The internal annotations struct stores null for hints that were not provided, and Tool.annotations omits those members instead of reporting false. This is the annotations part of the generic tool calling explainer (#375). See #53.
|
Should |
|
I want to better understand the motivation for this? Do we have evidence that models will treat explicitly set values different from missing values with their current defaults, if we give them the ability? That is, do any models want to treat an explicit I'm looking to how MCP handles this for inspiration too. In MCP technically tool annotations can be absent, however the spec explicitly prescribes semantic defaults for each annotation for the missing case: https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations-title (also see this post). Again it's not clear to me if models treat the missing default different from explicit values that match the missing default. If the "default" prescribed by the MCP spec is normatively enforced, than the answer is no (because harness aren't allowed to act on the difference, and the fact that missing values are observable on the wire protocol is entirely incidental). I think if we move forward with this, then we at least want to provide some kind of set of semantic defaults like MCP does. However, I still think that's worse than just doing it in our API directly. I think tri-state booleans are somewhat discouraged, so I only want to do this if it's clear models are lacking something real in our current spec. Otherwise, I'd follow the TAG guidance in https://w3ctag.github.io/design-principles/#optional-parameters:
I think this is largely backed up by whatwg/webidl#1485, which acknowledges that there are legitimate tri-state variable usages, but I'm personally not convinced this is one :) |
Removes the
= falsedefaults from the ToolAnnotations members (readOnlyHint,untrustedContentHint, consequentialHint, debugging). An omitted member now
stays absent instead of reading as false, so consumers can tell "not set"
apart from "explicitly false" (option 1b in #53).
Preview | Diff