Make "resource" optional on earlier protocols by dr3s · Pull Request #1017 · modelcontextprotocol/python-sdk

Make "resource" optional on earlier protocols in order to remain backwards compatible with servers on earlier versions.

Motivation and Context

#991 introduced breaking changes for servers on earlier protocol versions that don't support the resource param. This change requires the param only if either is true: PRM is available or the protocol is 2025-06-18 or later.

How Has This Been Tested?

unit tests

Breaking Changes

None

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