Repository navigation
Replies: 1 comment 1 reply
|
Thanks for the clear write-up. Yes, this fits ha-mcp. A picture sent as text is useless to the model, and ha-mcp already returns real images from two tools, so the building blocks exist. Some points that would shape it:
There are two ways to solve this:
Which one fits depends on your integration: can you change its action to return a reference instead of the base64 data? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The case
A Home Assistant custom integration has an action that returns a photo with
return_response. The response looks like this:{"id": "8ffadd57ad19", "mime": "image/jpeg", "size": 73141, "encoding": "base64", "data": "/9j/4AAQ…"}When an agent calls it through
ha_call_service, it gets that JSON as text. A 73 KB photo is about 97,000 characters. The client refused to put it in context ("exceeds maximum allowed tokens") and saved it to a file, so the model never saw the picture. A photo near 1 MB would be over a million characters.The idea
ha_get_camera_imagealready returns real image content, so ha-mcp can do this. Would you consider doing the same for a service response? For example, when a response has amimestarting withimage/and base64data, return it as MCP image content. I don't know how ha-mcp builds its results, so a different rule might suit it better. I'd like to know whether this is something you'd want before anyone writes code.Why it might matter
Any integration that returns a picture from an action has this same problem. Agents then have to decode the text into a file and open it with a separate tool.
Details
Home Assistant 2026.10.
All reactions