Skip to content

Fix JSON-RPC request ID type to match specification#416

Merged
alexhancock merged 1 commit intomainfrom
fix/json-rpc-request-id-type
Sep 4, 2025
Merged

Fix JSON-RPC request ID type to match specification#416
alexhancock merged 1 commit intomainfrom
fix/json-rpc-request-id-type

Conversation

@dsp-ant
Copy link
Copy Markdown
Member

@dsp-ant dsp-ant commented Sep 3, 2025

Fixes the issue that the Json RPC request id is u32. However the JSON RPC spec mentions that this is supposed to be a number, meaning it can be negative and is typically 64bit. So we need to use an i64 here.

@4t145
Copy link
Copy Markdown
Contributor

4t145 commented Sep 4, 2025

It looks like you are working on an outdated version, which hasn't been updated since half years ago?

@dsp-ant
Copy link
Copy Markdown
Member Author

dsp-ant commented Sep 4, 2025

Whoops. Somehow completely botched that. I'll update the PR. The problem is still valid that, since NumberOrString takes a u32 but likely needs to accept an i64

@dsp-ant dsp-ant force-pushed the fix/json-rpc-request-id-type branch from 0ff03de to ab79c05 Compare September 4, 2025 14:38
@github-actions github-actions bot added T-core Core library changes T-model Model/data structure changes labels Sep 4, 2025
The JSON-RPC 2.0 specification allows the ID field to be any JSON number,
including negative integers and large values. The previous u32 implementation
was limited to 0-4,294,967,295 and couldn't handle negative IDs.

Changes:
- Changed NumberOrString::Number from u32 to i64 to support full JSON number range
- Updated deserializer to handle both signed and unsigned integers
- Modified AtomicU32Provider to use AtomicU64 internally with i64 conversion
- Fixed progress token handling in meta.rs for i64 values
- Added comprehensive test for negative and large request IDs

This ensures full compliance with the JSON-RPC 2.0 specification.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dsp-ant dsp-ant force-pushed the fix/json-rpc-request-id-type branch from 5584862 to 57f9063 Compare September 4, 2025 15:06
@alexhancock alexhancock merged commit 9105ba7 into main Sep 4, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Sep 4, 2025
@alexhancock alexhancock deleted the fix/json-rpc-request-id-type branch September 4, 2025 21:22
takumi-earth pushed a commit to earthlings-dev/rmcp that referenced this pull request Jan 27, 2026
…tocol#416)

The JSON-RPC 2.0 specification allows the ID field to be any JSON number,
including negative integers and large values. The previous u32 implementation
was limited to 0-4,294,967,295 and couldn't handle negative IDs.

Changes:
- Changed NumberOrString::Number from u32 to i64 to support full JSON number range
- Updated deserializer to handle both signed and unsigned integers
- Modified AtomicU32Provider to use AtomicU64 internally with i64 conversion
- Fixed progress token handling in meta.rs for i64 values
- Added comprehensive test for negative and large request IDs

This ensures full compliance with the JSON-RPC 2.0 specification.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-model Model/data structure changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants