googleapis/mcp-toolbox · error · jsonrpc PARSE_ERROR

request body exceeds %d bytes

Error message

request body exceeds %d bytes

What it means

Error "request body exceeds %d bytes" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/server/mcp.go:532

			urlParams[k] = v[0]
		}
	}
	if len(urlParams) > 0 {
		ctx = util.WithUrlParams(ctx, urlParams)
	}

	limit := s.httpMaxRequestBytes
	r.Body = http.MaxBytesReader(w, r.Body, limit)

	// Read body first so we can extract trace context
	body, err := io.ReadAll(r.Body)
	if err != nil {
		// The id cannot be determined from an unreadable body. Per JSON-RPC 2.0,
		// the response id MUST be null in that case.
		// See https://www.jsonrpc.org/specification#response_object
		var maxErr *http.MaxBytesError
		if errors.As(err, &maxErr) {
			err = fmt.Errorf("request body exceeds %d bytes", limit)
		}
		s.logger.DebugContext(ctx, err.Error())
		render.JSON(w, r, jsonrpc.NewError(nil, jsonrpc.PARSE_ERROR, err.Error(), nil))
		return
	}

	// This ensures the transport span becomes a child of the client span
	// _meta.ProtocolVersion is not checked here for http transport.
	_, ctx = extractMeta(ctx, body)

	// Create span for HTTP transport
	ctx, span := s.instrumentation.Tracer.Start(ctx, "toolbox/server/mcp/http",
		trace.WithSpanKind(trace.SpanKindServer),
	)
	r = r.WithContext(ctx)

	var sessionId, protocolVersion string
	var session *sseSession

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/server/mcp.go:532 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/450b8e943aabe98f. Report an issue: GitHub.