mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-27 15:13:37 +08:00
The MCP content schema only allows text/image/audio/resource/resource_link.
PR#63 introduced a custom {type: "image_url"} block that passes Desktop's
extractImageBlocks() parsing but is rejected by the MCP SDK's schema
validation before it ever reaches the client, causing a "Invalid input"
error on every successful image generation.
Additionally, using base64 image blocks causes conversation history to
accumulate MB-scale data per image. After 3-4 generations the request
exceeds the 20MB API limit ("Request too large").
Fix (two-part):
1. MCP server: for URL-type results, return a standard text block with
markdown image syntax . No base64, no custom
types — passes schema validation and keeps conversation history lean.
Includes _meta.imageUrls for future extensibility.
2. Desktop extractImageBlocks: now also extracts image URLs from
markdown syntax () in text blocks, enabling
inline rendering of URL-based images from tool results.
This approach avoids the 20MB accumulation problem entirely — image URLs
are just a few bytes of text in the conversation history, while Desktop
still renders them inline.
Co-authored-by: 你的姓名 <you@example.com>