Repository navigation
Normalize supported MCP media types during content conversion - #1987
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
This was referenced Oct 5, 2026
Open
This branch has not been deployed
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 #1986.
Normalize the base MIME type when selecting and converting MCP images and resources, and emit canonical image media types. Previously an uppercase or parameterized supported type could raise UnsupportedMCPValueError or cause selection to return a later resource.
Normalization is private and shared by the existing conversion paths. It strips the parameter suffix, trims surrounding whitespace and lowercases the type/subtype. Original objects, bytes, cache-control fields, helper tags and file-upload metadata are preserved. No new base types, charset transcoding or parameter-grammar validation are added.
Validation
Existing public-helper tests cover canonical, mixed-case and parameterized values, image/PDF/text resources, exact payloads, first-supported selection, missing-blob and unsupported-type controls, cache control and nonmutation. On unchanged main, 15 fail and 43 pass.
The MCP suite passes 58 tests with both the locked MCP SDK and MCP v2 on Python 3.10.16 and 3.14.7. The Pydantic v1 run skips the optional MCP module. Repository ./scripts/format, complete ./scripts/lint and git diff --check pass.
Tests use mock/local data through ./scripts/test. No live API requests or other operating-system runs. No dependencies, public signatures, release metadata or workflow changes.
Corresponding Go SDK fix: anthropics/anthropic-sdk-go#469