crw icon indicating copy to clipboard operation
crw copied to clipboard

MCP `maxLength` truncation cuts mid-table/mid-word with no continuation handle, dropping the spec table on product pages

Open thedancingdeveloper opened this issue 1 month ago • 3 comments

Environment

  • Self-hosted crw nightly on Node B, images pulled 2026-11-01, MCP crw_scrape.

Repro

  1. crw_scrape url=https://www.jbhifi.com.au/products/ffalcon-43-u65a-4k-led-google-tv-2026, maxLength: 9000.
  2. Output ends ...Resolution (Pixels)\n\n3840 x 2160\n\nRefresh Ra\n…[truncated by crw-mcp maxLength] with "truncated": true.

Expected

Truncation at a block boundary, and a way to continue (offset/cursor), or content ordered so the important section is not cut. The tool description says default is ~15000 and 0 is unbounded, but nothing says that product pages need more than 9000 or how to page.

Actual

Refresh rate, HDR, HDMI and the rest of the Specs table are lost; the only recourse is re-scraping with maxLength: 0 (full page, ~3x the tokens), because related-product and recommendation blocks come before the specs and consume the budget.

Frequency

Always at maxLength <= 9000 on JB Hi-Fi product pages (4/4).

Log excerpt

"...Refresh Ra\n…[truncated by crw-mcp maxLength]","metadata":{...},"truncated":true

thedancingdeveloper avatar Nov 01 '26 21:11 thedancingdeveloper

The truncation text comes from upstream's crw-mcp-proto (crates/crw-mcp-proto/src/lib.rs, "…[truncated by crw-mcp maxLength]"), and the crw-mcp binary in the stock image ships the same code; the third-party build compiles -p crw-mcp unmodified. So this is upstream behaviour, not our wrapper's.

Disclosure: this was run on a third-party build, swack-tools/crw-build-aio-mcp, from crw 147c8d6 plus that repo's patches, with non-default renderer settings (RENDERER__MODE=chrome, RENDER_JS_DEFAULT=true, CHROME_INTERCEPT_RESOURCES=false, CHROME_CONTEXT_POOL_ENABLED=false). Sorry for not saying so when filing.

thedancingdeveloper avatar Nov 02 '26 02:11 thedancingdeveloper

thanks, confirmed on stock as you said.

#667 changes two things:

  • truncation now cuts on a paragraph break, then a line break, then a space (only falling back to a hard cut if that would drop more than half the budget), so a table is cut between rows, not mid-cell
  • the marker says how much is left and how to get it: …[truncated by crw-mcp maxLength: chars 0-2761 of 7488; startIndex=2761 continues]. crw_scrape takes a new startIndex to fetch the next window, so an agent can page through instead of re-scraping with maxLength: 0

tested on the ffalcon product page: five windows joined back byte-identical to the full scrape. one caveat, documented: each call fetches again (or reuses a cached fetch), so on a page that renders differently per fetch the offset can shift.

us avatar Nov 03 '26 13:11 us

fixed in #667 and live on the hosted mcp now. a truncated result ends on a block boundary with a marker like …[truncated by crw-mcp maxLength: chars 0-1995 of 17697; startIndex=1995 continues], and crw_scrape takes startIndex to read the next window.

self-hosted crw-mcp gets it with v0.40.0 (release pr #668). thanks, closing.

us avatar Nov 03 '26 17:11 us