Carry MCP tool annotations through to the tool mapping - #2476
Merged
Conversation
`tools/list` returns per-tool behaviour hints — readOnlyHint, destructiveHint, idempotentHint, openWorldHint — and the listing discarded all of them, keeping only `annotations.title` as a description fallback. They are the natural input to an approval policy, which cannot be written until the data reaches it. Hints now ride on McpToolMapping, next to the server and tool they belong to. Only real booleans are kept, so a server sending a truthy string cannot be read as having declared a hint, and they are deliberately not merged with the spec's defaults: a caller needs to tell "declared safe" from "said nothing", because an undeclared tool defaults to destructive, not safe. Annotations stay out of the OpenAI tool definition — they are not part of the function schema and strict providers reject unknown fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tools/listreturns per-tool behaviour hints — readOnlyHint, destructiveHint, idempotentHint, openWorldHint — and the listing discarded all of them, keeping onlyannotations.titleas a description fallback. They are the natural input to an approval policy, which cannot be written until the data reaches it.Hints now ride on McpToolMapping, next to the server and tool they belong to. Only real booleans are kept, so a server sending a truthy string cannot be read as having declared a hint, and they are deliberately not merged with the spec's defaults: a caller needs to tell "declared safe" from "said nothing", because an undeclared tool defaults to destructive, not safe.
Annotations stay out of the OpenAI tool definition — they are not part of the function schema and strict providers reject unknown fields.