Shrink get_page_image's tool result to avoid CLIJSONDecodeError #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/shrink-page-image-for-vision"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Shrink get_page_image's tool result to avoid CLIJSONDecodeError
rsvg-convert renders each page at native size, and base64-encoding
that PNG for the MCP wire format adds ~33% -- once relayed through
the Claude CLI's stream-json stdout, that single NDJSON line can
exceed the Claude Agent SDK's default 1 MiB per-line buffer. This
caused real CLIJSONDecodeError failures on the eprosveta-mcp sibling
for a heavy page; applying the same fix here preemptively. Downscale
to at most 1600px on the long edge and fall back to JPEG at
decreasing quality if still over budget; get_page_image_url/
_serve_page_image stay full-resolution since those are for a human
directly viewing the page.