mcp: allow requests before notifications/initialized
Upon a closer reading of the spec, it is OK for the server to response to client requests before it has received notifications/initialized (as long as it has received initialize). This effectively rolls back the fix from #225. Some hooks are left for enforcing strictness around server->client requests prior to initialized. These will be revisited in subsequent CLs. For #395
This commit is contained in:
parent
b774809086
commit
5ccd97fafc
1 changed files with 53 additions and 6 deletions
|
|
@ -346,9 +346,12 @@ func notifySessions[S Session, P Params](sessions []S, method string, params P)
|
|||
if sessions == nil {
|
||||
return
|
||||
}
|
||||
// TODO: make this timeout configurable, or call Notify asynchronously.
|
||||
// TODO: make this timeout configurable, or call handleNotify asynchronously.
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
// TODO: there's a potential spec violation here, when the feature list
|
||||
// changes before the session (client or server) is initialized.
|
||||
for _, s := range sessions {
|
||||
req := newRequest(s, params)
|
||||
if err := handleNotify(ctx, method, req); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue