Skip to content

Conversation

sreenaths
Copy link
Contributor

@sreenaths sreenaths commented Aug 26, 2025

The JSON-RPC version is fixed at 2.0 for MCP messages. However, as the value is not set by default, we have to pass the correct value every time a model is instantiated.

Motivation and Context

This change simplifies model instantiation by automatically setting the JSON-RPC version. Additionally, if the version ever needs to change in the future, it only has to be updated in a single place.

For example

JSONRPCMessage(
    root=JSONRPCRequest(
        # jsonrpc="2.0", - This wouldn't be required
        id=1,
        method="ping"
    )
),

How Has This Been Tested?

Tests were improved and are working as expected.

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

None

@sreenaths sreenaths requested a review from a team as a code owner August 26, 2025 22:53
@sreenaths sreenaths requested a review from ihrpr August 26, 2025 22:53
@sreenaths sreenaths force-pushed the setting-default-jsonrpc-version branch from 0302041 to d626174 Compare August 26, 2025 22:58
@sreenaths
Copy link
Contributor Author

Hi @ochafik
When you have a chance, please review this PR.
It is similar to PR #1292 that you had helped with before.
Thank you.

@sreenaths sreenaths force-pushed the setting-default-jsonrpc-version branch from d626174 to 18051bc Compare September 1, 2025 04:44
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.

1 participant