[BUG] MCP fails when reponse has unsupported image format
Resolved 💬 6 comments Opened Dec 30, 2025 by nickydonna Closed Mar 3, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When an MCP server returns tool results containing images with unsupported media types (e.g., image/svg+xml), Claude Code fails with a 400 API error. The Claude API only supports image/jpeg, image/png, image/gif, and image/webp, but Claude Code doesn't filter out unsupported formats from MCP tool responses.
Steps to Reproduce
- Configure an MCP server that returns multiple image formats (e.g., mermaid-mcp, https://docs.mermaidchart.com/ai/mcp-server)
- Call the tool: validate_and_render_mermaid_diagram
- The response has a png and a svg, there is no way to skip the invalid format.
- Claude errors, and it just replies with the error over and over again
What Should Happen?
I would expect, one of the following:
- The error to happen but have a way to ignore that value
- Claude identifying that there is a supported image and use it
- Claude providing a better messaging.
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.2.content.0.tool_result.content.2.image.source.base64.media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or
'image/webp'"},"request_id":"req_011CWd26zFQxj5Qjwj6psSAY"}
Steps to Reproduce
- Configure an MCP server that returns multiple image formats (e.g., mermaid-mcp, https://docs.mermaidchart.com/ai/mcp-server)
- Call the tool: validate_and_render_mermaid_diagram
- The response has a png and a svg, there is no way to skip the invalid format.
- Claude errors, and it just replies with the error over and over again
Example:
Prompt:
Validate this mermaid diagram
sequenceDiagram
participant Customer
participant Website
participant "PaymentGateway" as PG
participant Warehouse
Customer->>Website: Browse products
Customer->>Website: Place order
Website->>Customer: Show order summary<br/>Request payment
Website->>PG: Request payment authorization
PG-->>Website: Payment status (approved/declined)
alt Payment approved
Website->>Warehouse: Send order details
Warehouse-->>Website: Confirm order processing
Website->>Customer: Order placed, confirmation sent
else Payment declined
Website->>Customer: Payment failed, request new method
end
Response:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.2.content.0.tool_result.content.2.image.source.base64.media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or
'image/webp'"},"request_id":"req_011CWd26zFQxj5Qjwj6psSAY"}
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
I'm using kitty-terminal
Screen shot:
<img width="2242" height="1091" alt="Image" src="https://github.com/user-attachments/assets/fa2043f9-d7f8-4385-a886-f9a5d1358893" />
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗