Skip to content

Conversation

@findleyr
Copy link
Contributor

Implement the concurrency model described in #26: notifications are synchronous, but calls are asynchronous (except for 'initialize'). To achieve this, implement jsonrpc2.Async(ctx) to signal asynchronous handling. This is simpler to use than returning ErrAsyncResponse and calling Respond, and since this is an internal detail we don't need to worry too much about whether it's idiomatic.

Add tests that verify both features, for both client and server.

Also:

  • replace req.ID.IsValid with req.IsCall
  • remove the methodHandler type as we can just use MethodHandler

Fixes #26

Implement the concurrency model described in modelcontextprotocol#26: notifications are
synchronous, but calls are asynchronous (except for 'initialize'). To
achieve this, implement jsonrpc2.Async(ctx) to signal asynchronous
handling. This is simpler to use than returning ErrAsyncResponse and
calling Respond, and since this is an internal detail we don't need to
worry too much about whether it's idiomatic.

Add tests that verify both features, for both client and server.

Also:
- replace req.ID.IsValid with req.IsCall
- remove the methodHandler type as we can just use MethodHandler

Fixes modelcontextprotocol#26
@findleyr findleyr requested review from jba and samthanawalla August 18, 2025 23:51
@findleyr findleyr merged commit 3db848a into modelcontextprotocol:main Aug 19, 2025
5 checks passed
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.

Design: concurrency model

2 participants