Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Audio(data=b"") raises "Either path or data can be provided", while Image(data=b"") works

Open Beginner friendly
#3,656 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@KaiyiQuan is already working on this.

Since Oct 8, 2026.

  • #3657 by @KaiyiQuan — closed without merging

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

The relevant code is in src/mcp/server/mcpserver/utilities/types.py, specifically the Audio.__init__ method around line 66. Replace the truthiness check if not bool(path) ^ bool(data) with path is None and data is None / path is not None and data is not None checks matching the Image class implementation. Add a test for Audio(data=b"") to confirm it no longer raises ValueError and produces empty base64 data, consistent with Image's behavior. Done is when the new test passes and Audio(data=b"") works as expected.

Written by the indexing model from the issue text.

Description

bug v1 v2
Initial Checks
Release line

2.x

Description

mcp.server.mcpserver.utilities.types.Audio rejects an empty byte payload that Image accepts. Audio.__init__ checks if not bool(path) ^ bool(data), so data=b"" is treated as missing and raises ValueError("Either path or data can be provided"). Image.__init__ checks path is None and data is None / path is not None and data is not None, so Image(data=b"") builds content with data="".

Empty bytes are a valid payload here: the schema's AudioContent.data is a base64 string with no minimum length, and base64.b64encode(b"") is "". Audio.to_audio_content() itself already uses self.data is not None. The truthiness check also produces the same misleading message when both path and data are passed.

Using the same two is None checks as Image would fix both. I'm happy to send that change with a test if you'd like an outside PR for it.

Example Code
from mcp.server.mcpserver.utilities.types import Audio, Image

print(Image(data=b"").to_image_content().data)  # ''
Audio(data=b"")  # ValueError: Either path or data can be provided
Python & MCP Python SDK

Python 3.13, Windows 11; main at 91941ed (src/mcp/server/mcpserver/utilities/types.py:66)

Dominant language
Python
Stars
24.5k
Forks
4k
Avg merge
1d 4h
Merged PRs (30d)
33

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/python-sdk

All issues in modelcontextprotocol/python-sdk

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.