You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcp: CallToolResult structuredContent loses large integer precision #1236
mcp.ClientSession.CallTool silently rounds large JSON integers in a tool result's structuredContent field.
This is the result-side equivalent of #1201. It also affects users of the low-level Server.AddTool API, so avoiding the typed tool argument path does not avoid this result decode.
Environment
Go MCP SDK: v1.7.0
Go: go1.27.0
Observed behavior
A server returns this valid JSON value in structuredContent:
{"id":9007199254740993}
The official SDK client exposes the value as a float64 with the value 9007199254740992. No error is returned.
The loss occurs while the SDK decodes the JSON-RPC result into CallToolResult.StructuredContent any. Application code cannot recover the original integer after this decode.
Expected behavior
Generic JSON numbers in structuredContent retain their exact wire value. A decoder that uses json.Number or an exact raw JSON representation would avoid silent rounding.
Why this needs an SDK fix
A server bridge cannot repair the value after the official SDK has decoded the request or result envelope. Re-reading HTTP bodies would violate transport ownership and does not help in-memory transports. The SDK needs an exact-number decode path for generic JSON fields in parsed protocol envelopes.
Activity
mcp: preserve structured content number precision (modelcontextprotoc…