[Server][Tests] Complete the multi round-trip request flow (SEP-2322) (#446)
The revision has no way for a server to put a request on a response stream, so a handler that needs input from the user says so in its result instead: a handler returning InputRequiredResult comes back as resultType: "input_required" with the asks and an opaque requestState, and the client retries the same request carrying inputResponses. RequestContext::getInputContext() is what the handler reads them through. RequestStateCodec signs and time-bounds the state, so a tampered or expired one is refused rather than trusted - the state travels through the client, which is not a place to keep something the server later believes.
This commit is contained in:
parent
de35ca40bf
commit
ef0c1c2808
1 changed files with 906 additions and 341 deletions
|
|
@ -20,13 +20,9 @@ use Mcp\Schema\ServerCapabilities;
|
|||
/**
|
||||
* The server's response to a `server/discover` request.
|
||||
*
|
||||
* This is the modern era's replacement for `InitializeResult`. The difference
|
||||
* is not just the method name: `initialize` *negotiates* a single version and
|
||||
* remembers it for the connection, whereas `server/discover` merely *reports*
|
||||
* every version this server speaks and lets each subsequent request pick one.
|
||||
*
|
||||
* Server identity travels in the result `_meta` rather than in a body
|
||||
* `serverInfo` member (spec PR #3002 removed the latter).
|
||||
* The modern era's replacement for `InitializeResult`: it reports every
|
||||
* version this server speaks rather than negotiating one, and each request
|
||||
* picks from that list.
|
||||
*
|
||||
* @author Christopher Hertel <mail@christopher-hertel.de>
|
||||
*/
|
||||
|
|
@ -46,9 +42,8 @@ class DiscoverResult implements ResultInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Carries no `resultType`, caching hints or serverInfo identity: those are
|
||||
* wire vocabulary, stamped by {@see \Mcp\Server\Wire\Rev2026Codec} on the
|
||||
* way out. What is modelled here is only what discovery actually answers.
|
||||
* `resultType`, caching hints and serverInfo are wire vocabulary, stamped
|
||||
* by {@see \Mcp\Server\Wire\Rev2026Codec} rather than modelled here.
|
||||
*
|
||||
* @return array{
|
||||
* supportedVersions: list<string>,
|
||||
|
|
|
|||
Loading…
Reference in a new issue