{{ message }}
Repository navigation
Conversation
Contributor
2 tasks done
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.

Fixes #3467
Summary
FuncMetadata.convert_resultvalidatesCallToolResult.structured_contentbut returns the result unchanged. Plain model returns validate thenmodel_dump/dump_pythonwithby_alias=True, so wire keys matchoutputSchema. The CallToolResult path skipped that dump, so Python field names that pass validation (populate_by_name/by_name) could be emitted whileoutputSchemaadvertises aliases.Motivation and Context
Clients validating
structuredContentagainst the publishedoutputSchemareject otherwise-valid tool results when aliases are used. This aligns the CallToolResult short-circuit with the plain-return path (#1073 / #1099). Distinct from #3100 / #3118 (schema generation mode).How Has This Been Tested?
test_call_tool_result_structured_content_alias_normalizedpy -3.12 -m pytest tests/server/mcpserver/test_func_metadata.py— 59 passed{"first":...}instead of{"field_first":...}Breaking Changes
None intended. Wire output for CallToolResult tools that previously leaked Python field names will now use aliases (matching schema / plain returns).
Types of changes
Checklist
help wanted, or I'm a maintainer)Additional context
Smallest fix: after
validate_python(..., by_alias=True, by_name=True)on CallToolResult.structured_content, dump withby_alias=Trueandmodel_copythe normalized dict — same serialization as the plain-return path.AI disclosure
This PR was prepared with AI assistance (Cursor / Grok): issue draft, repro, patch, and PR text. Changes were verified locally on current
main(08a3bc8) with the new regression test and the fulltest_func_metadata.pyfile.