From fa17e7df28c32fb0bdfa5acd8f274a715007d36e Mon Sep 17 00:00:00 2001 From: John Pugliesi Date: Wed, 8 Apr 2026 17:58:38 -0700 Subject: [PATCH] mcp: preserve transport errors in error chain using %w instead of %v --- mcp/streamable.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mcp/streamable.go b/mcp/streamable.go index 76f2b0e4..4236c88e 100644 --- a/mcp/streamable.go +++ b/mcp/streamable.go @@ -1782,14 +1782,14 @@ func (c *streamableClientConn) Write(ctx context.Context, msg jsonrpc.Message) e // Failure to set headers means that the request was not sent. // Wrap with ErrRejected so the jsonrpc2 connection doesn't set writeErr // and permanently break the connection. - return nil, nil, fmt.Errorf("%s: %w: %v", requestSummary, jsonrpc2.ErrRejected, err) + return nil, nil, fmt.Errorf("%s: %w: %w", requestSummary, jsonrpc2.ErrRejected, err) } resp, err := c.client.Do(req) if err != nil { // Any error from client.Do means the request didn't reach the server. // Wrap with ErrRejected so the jsonrpc2 connection doesn't set writeErr // and permanently break the connection. - err = fmt.Errorf("%s: %w: %v", requestSummary, jsonrpc2.ErrRejected, err) + err = fmt.Errorf("%s: %w: %w", requestSummary, jsonrpc2.ErrRejected, err) } return req, resp, err }