Skip to content

Conversation

@huangjia2019
Copy link

@huangjia2019 huangjia2019 commented Jun 26, 2025

Bug fix: a missing type variable ReceiveResultT in the BaseSession class definition.

Motivation and Context

Added ReceiveResultT as a generic type parameter to BaseSession.

This aligns BaseSession's generic signature with its actual method usage, particularly for:

send_request() which returns a ReceiveResultT

_send_response() which also sends a ReceiveResultT in some cases

Why
Without ReceiveResultT in the class signature, type checking tools (like Pyright or MyPy) may raise warnings or fail to infer correct types.

The class was already using ReceiveResultT internally, so this fix improves type completeness and consistency.

Impact
Improves type safety and developer experience for consumers of the MCP Python SDK

How Has This Been Tested?

No behavior change; purely type annotation fix

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

@huangjia2019 huangjia2019 changed the title Bug fix: This PR fixes a missing type variable ReceiveResultT in the BaseSession class definition. Bug fix: a missing type variable ReceiveResultT in the BaseSession class definition. Jun 26, 2025
@huangjia2019
Copy link
Author

Will someone review this PR?

Copy link
Contributor

@felixweinberger felixweinberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution and for drawing attention to this!

Can we make the type explicit rather than Any? Also we would generally like to avoid additional linter suppression if possible.

@felixweinberger felixweinberger added the needs more work Not ready to be merged yet, needs additional changes. label Sep 5, 2025
@felixweinberger
Copy link
Contributor

Hi @huangjia2019 closing this PR for now to ensure we prioritize reviews appropriately on our team, feel free to ping here or reopen if you plan to return to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs more work Not ready to be merged yet, needs additional changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants