Repository navigation
Raise the WebMCP invoke input limit to 4 MiB - #500
Merged
Merged
Conversation
yummybomb
approved these changes
Nov 2, 2026
Contributor
There was a problem hiding this comment.
lgtm, one small edge case not sure if its worth fixing:
valid 4 MiB inputs can exceed the custom-CDP transport limit —
custom CDP tools embed the serialized input into code, then JSON-encode that code again. an escape-heavy input of exactly 4,194,304 bytes passes both new limits but produces an 8,389,676-byte REPL request, exceeding its unchanged 8,388,608-byte cap. the tool never executes; callers receive status: "error". allow transport headroom for double encoding plus the wrapper, and add a boundary regression test.
edit: seems not worth fixing lowkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Raises the
POST /webmcp/invokeinput limit from 1 MiB to 4 MiB after JSON serialization, with the request body cap moving to 4 MiB plus the existing 4 KiB envelope allowance. MCP clients commonly allow 4 MiB tool calls, so agents send inputs (for example images asdata:URLs) that the old limit rejected.maxWebMCPInputBytesgoes to4 << 20;maxWebMCPRequestBytesand the request-size middleware follow it.WebMCPInvokeRequest.inputand the request body) say 4 MiB;lib/oapi/oapi.goregenerated (embedded spec only).Chromium handles larger inputs:
WebMCP.invokeToolwith 1.5, 4, 8, and 16 MiB string inputs completed on a production browser over metro's CDP proxy (4 MiB in about 0.6s).Rollout
The public API checks the same limit, so kernel/kernel#5165 raises it there. Ship this image before the API change reaches production; until then, browsers on older images reject inputs over 1 MiB with a 400. Docs: kernel/docs#738.
Tests
TestInvokeWebMCPToolAcceptsInputAboveOneMiB(2 MiB input reaches the client).go test ./cmd/api/api/ -run WebMCPpasses;go vetclean.