Skip to content

Wrap each request in a service scope#276

Merged
stephentoub merged 3 commits intomodelcontextprotocol:mainfrom
stephentoub:scopedservices
Apr 11, 2025
Merged

Wrap each request in a service scope#276
stephentoub merged 3 commits intomodelcontextprotocol:mainfrom
stephentoub:scopedservices

Conversation

@stephentoub
Copy link
Copy Markdown
Contributor

As long as I was touching the request handlers, I also made a change I've been meaning to make, which is to have all of these delegate callbacks return ValueTask instead of Task.

Fixes #234
Fixes #198

@stephentoub stephentoub requested a review from halter73 April 11, 2025 03:54
Copy link
Copy Markdown
Contributor

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

It might also be interesting to do the same thing for client notification/sampling/roots handlers, but I agree the server is the most important.

@stephentoub stephentoub merged commit f4c87f5 into modelcontextprotocol:main Apr 11, 2025
7 checks passed
@stephentoub stephentoub deleted the scopedservices branch April 11, 2025 23:19
@jeffhandley jeffhandley added the breaking-change This issue or PR introduces a breaking change label Feb 20, 2026
@jeffhandley
Copy link
Copy Markdown
Contributor

Adding the breaking-change label retroactively during release notes revision.

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

Labels

breaking-change This issue or PR introduces a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[McpServerToolType] class does not support dependency injection for constructors with parameters Resolving scoped service is not supported

3 participants