Shrink get_page_image's tool result to avoid CLIJSONDecodeError #1

Merged
martian merged 1 commit from fix/shrink-page-image-for-vision into main 2026-09-30 18:37:39 +00:00
Owner

Shrink get_page_image's tool result to avoid CLIJSONDecodeError

A full-resolution page PNG (pages render up to ~2136x2904), once
base64-encoded for the MCP wire format and relayed through the Claude
CLI's stream-json stdout, could exceed the Claude Agent SDK's default
1 MiB per-line buffer -- this caused real CLIJSONDecodeError failures
mid-turn for students reading a heavy workbook page. 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.

Shrink get_page_image's tool result to avoid CLIJSONDecodeError A full-resolution page PNG (pages render up to ~2136x2904), once base64-encoded for the MCP wire format and relayed through the Claude CLI's stream-json stdout, could exceed the Claude Agent SDK's default 1 MiB per-line buffer -- this caused real CLIJSONDecodeError failures mid-turn for students reading a heavy workbook page. 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.
A full-resolution page PNG (pages render up to ~2136x2904), once
base64-encoded for the MCP wire format and relayed through the Claude
CLI's stream-json stdout, could exceed the Claude Agent SDK's default
1 MiB per-line buffer -- this caused real CLIJSONDecodeError failures
mid-turn for students reading a heavy workbook page. 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.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
selfhosted-bg/eprosveta-mcp!1
No description provided.