Summary
When a text-only model such as zai-coding-plan/glm-4.7 uses the Read tool on an image, the tool still emits a data:image/...;base64,... attachment. That attachment can move through the message-building path before the provider layer finally rejects image input.
Problem
This is the wrong place to catch the error. By the time the provider rejects the image, the image payload has already entered prompt construction and can cause unnecessary context growth or overflow.
Expected behavior
If the current model does not support image or PDF input, the file should not be attached to the conversation at all. The tool or message layer should emit a short text explanation instead.
Notes
A complete fix should guard both the Read tool path and the message conversion path for tool-result media so unsupported media cannot be reintroduced later by another tool.
Summary
When a text-only model such as
zai-coding-plan/glm-4.7uses theReadtool on an image, the tool still emits adata:image/...;base64,...attachment. That attachment can move through the message-building path before the provider layer finally rejects image input.Problem
This is the wrong place to catch the error. By the time the provider rejects the image, the image payload has already entered prompt construction and can cause unnecessary context growth or overflow.
Expected behavior
If the current model does not support image or PDF input, the file should not be attached to the conversation at all. The tool or message layer should emit a short text explanation instead.
Notes
A complete fix should guard both the
Readtool path and the message conversion path for tool-result media so unsupported media cannot be reintroduced later by another tool.