Repository navigation
Conversation
Audio.__init__ validated with `not bool(path) ^ bool(data)`, treating `data=b""` as missing and raising ValueError, while Image accepts an empty byte payload (`Image(data=b"")` works). Both helpers should treat only None as absent. Align Audio's validation with Image's (None-based checks, same error messages). Fixes modelcontextprotocol#3656
|
This PR has been closed automatically. This repo only keeps pull requests open when they come from a maintainer, or from a contributor a maintainer has assigned to the linked issue, and you aren't currently assigned to #3656. If a maintainer assigns you to #3656, this PR reopens on its own and there's nothing more you need to do here. Assignment is a maintainer call based on capacity; comments that only ask to be assigned don't factor in. What does help is engaging on the issue itself by confirming the repro, explaining why it matters for your use case, or describing the approach you'd take. You're welcome to keep pushing commits here (just avoid force-pushing, since GitHub can't reopen a rewritten branch), but that on its own won't get the PR reviewed or the issue assigned, and realistically most auto-closed PRs stay closed. There's no need to open a new PR either way. CONTRIBUTING.md has the full reasoning, but in short:
Maintainers: reopen, remove |
Summary
Audio(data=b"")raisesValueError("Either path or data can be provided")whileImage(data=b"")works.Audio.__init__validated withnot bool(path) ^ bool(data), so a falsy-but-present empty bytes payload was treated as missing.Change
Align
Audio's validation withImage's: raise only when bothpath is None and data is None(or both provided). Same messages as Image (Either path or data must be provided/Only one of path or data can be provided).Verification
New tests
tests/server/mcpserver/utilities/test_media_types.py:Audio(data=b""), non-empty data, path-only, and the two error paths (6 passed).Fixes #3656