Skip to content

fix: preserve text attachments with MIME parameters - #1025

Merged
evalstate merged 1 commit into
evalstate:mainfrom
BlueLi66:fix/mime-type-parameters
Oct 21, 2026
Merged

evalstate merged 1 commit into
evalstate:mainfrom
BlueLi66:fix/mime-type-parameters

Conversation

@BlueLi66

@BlueLi66 BlueLi66 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Attaching a UTF-8 XML file with MCPFile(path, mime_type="application/xml; charset=utf-8") incorrectly creates a binary resource. The Anthropic converter then replaces its body with an unsupported-format notice, while the same file with application/xml works.

Extract the media type before parameters in normalize_mime_type, preserving existing case/whitespace normalization, alias handling, and original attachment MIME metadata. Add regressions through MCPFile → AnthropicConverter to verify that the request retains the actual text.

The parameterized XML form is documented in RFC 7303 section 8.1. This change addresses classification; charset transcoding and other provider-specific conversion branches remain outside its scope.

Validation

  • Identical regression file on Windows/Python 3.12.15: 4 failed, 1 passed on baseline; 5 passed with the fix.
  • Ubuntu 24.04 WSL2, locked dependencies: 908 related tests passed on Python 3.14.8, and 908 passed on Python 3.15.0.
  • Full format, lint, typecheck, and internal-resource validation scripts passed on Python 3.14.8.
  • uv run scripts/cpd.py --check passed with Temurin Java 17 / PMD 7.27.0: 7 approved structural findings, no new duplication.
  • Three pre-existing test failures and 39 typecheck diagnostics reproduce on the Windows baseline; none appear in the Linux checks above.
  • Full-suite, integration/e2e/package jobs, live-provider calls, and hosted GitHub Actions were not run.

Prepared with AI assistance from Codex.

Contributor-note question

You're given a calfskin wallet for your birthday. How would you feel about using it?

It would be my first time receiving a gift like this, and I would use it to hold my cards.

@evalstate
evalstate merged commit 6d9f93b into evalstate:main Oct 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants