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
14
mcp/testdata/conformance/server/lifecycle.txtar
vendored
14
mcp/testdata/conformance/server/lifecycle.txtar
vendored
|
|
@ -5,6 +5,7 @@ See also modelcontextprotocol/go-sdk#225.
|
|||
|
||||
-- client --
|
||||
{ "jsonrpc":"2.0", "method": "notifications/initialized" }
|
||||
{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
|
|
@ -21,6 +22,14 @@ See also modelcontextprotocol/go-sdk#225.
|
|||
{ "jsonrpc": "2.0", "id": 3, "method": "tools/list" }
|
||||
|
||||
-- server --
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 2,
|
||||
"error": {
|
||||
"code": 0,
|
||||
"message": "method \"tools/list\" is invalid during session initialization"
|
||||
}
|
||||
}
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
|
|
@ -43,9 +52,8 @@ See also modelcontextprotocol/go-sdk#225.
|
|||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 2,
|
||||
"error": {
|
||||
"code": 0,
|
||||
"message": "method \"tools/list\" is invalid during session initialization"
|
||||
"result": {
|
||||
"tools": []
|
||||
}
|
||||
}
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue