Skip to content

fix(mcp): use %v and ID.Raw() for jsonrpc response summary - #1382

Merged
guglielmo-san merged 3 commits into
modelcontextprotocol:mainfrom
PratikDhanave:fix/streamable-jsonrpc-id-format-verb
Oct 12, 2026
Merged

guglielmo-san merged 3 commits into
modelcontextprotocol:mainfrom
PratikDhanave:fix/streamable-jsonrpc-id-format-verb

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

requestSummary formatted msg.ID with %d:

requestSummary = fmt.Sprintf("sending jsonrpc response #%d", msg.ID)

msg.ID is a jsonrpc.ID struct (no String()/Formatter), so %d yields garbage — {%!d(string=req-1)} for a string ID, {5} (stray braces) for an int ID — which then shows up in the user-facing errors that interpolate requestSummary (fmt.Errorf("%s: %v", requestSummary, err)). Use %v on msg.ID.Raw(), the idiom already used elsewhere in this file (reqID.Raw()).

go build ./..., go vet ./mcp/ pass.

… a struct)

requestSummary formatted `msg.ID` (a jsonrpc.ID struct, no Stringer/Formatter)
with %d, producing garbage like `{%!d(string=req-1)}` or `{5}` in the
user-facing errors that interpolate requestSummary. Use %v on msg.ID.Raw(), the
same idiom already used elsewhere in this file.
@guglielmo-san
guglielmo-san merged commit a362128 into modelcontextprotocol:main Oct 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants