Files
claude-code/src
shaleloop 26ddbda849 fix: align mcp transform pipeline with Anthropic Claude Code 2.1.128
Add ImageLimits type and plumb optional limits through the chain:
callMCPTool/callMCPToolWithUrlElicitationRetry -> processMCPResult ->
transformMCPResult -> transformResultContent -> maybeResizeAndDownsampleImageBuffer.
When provided, limits override the module-level defaults
(IMAGE_TARGET_RAW_SIZE, IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
API_IMAGE_MAX_BASE64_SIZE) inside maybeResizeAndDownsampleImageBuffer.
When undefined, behavior is unchanged for current callers.

Add _meta preservation in the text-block case of transformResultContent
(only when the caller opts in via includeMeta=true). transformMCPResult
passes includeMeta=true on the tool-result path; the prompt-handler call
site keeps the default false, preserving prior behavior.

Add skipLargeOutput early-return in processMCPResult after the IDE check:
when the caller passes skipLargeOutput=true and the content has no images,
the function returns content directly without large-output handling.

Add unwrap-to-text in processMCPResult for the persisted-content path:
when the large-string format gate is enabled
(MCP_TRUNCATION_PROMPT_OVERRIDE env var, or
tengu_mcp_subagent_prompt Statsig gate), and the content is a single
bare text block (no annotations, no _meta), unwrap to raw text and
switch the format description to 'Plain text'. Default-off; gate-off
behavior is unchanged.

Verified structurally against the 2.1.128 binary: function signatures,
the IDE check, gate logic, _meta-unwrap pattern, and imageLimits
plumbing match this implementation.
2026-05-05 14:53:57 -07:00
..
2026-05-05 19:36:38 +08:00
2026-04-16 20:59:29 +08:00
2026-05-01 21:39:30 +08:00
2026-03-31 19:22:47 +08:00
2026-05-01 21:39:30 +08:00
2026-05-01 21:39:30 +08:00
2026-05-01 21:39:30 +08:00
2026-05-01 21:39:30 +08:00
2026-05-01 21:39:30 +08:00
2026-03-31 23:32:58 +08:00
2026-03-31 19:22:47 +08:00
2026-05-01 21:39:30 +08:00
2026-03-31 19:22:47 +08:00
2026-03-31 19:22:47 +08:00
2026-03-31 19:22:47 +08:00
2026-03-31 19:22:47 +08:00
2026-03-31 19:22:47 +08:00
2026-05-01 21:39:30 +08:00