[Client] Expose session ID from HttpTransport (#497)
* Expose session ID from HttpTransport * [Client] State what getSessionId() returns on 2026-07-28 That revision removed protocol-level sessions (SEP-2567), so the getter is always null there. Adds the changelog entry. --------- Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
This commit is contained in:
parent
c5dbfb64e5
commit
418034f2b0
1 changed files with 68 additions and 0 deletions
|
|
@ -121,6 +121,22 @@ class HttpTransport extends BaseTransport implements HeaderAwareTransportInterfa
|
|||
$this->headerCallback = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* The session ID minted by the server for this connection, if any.
|
||||
*
|
||||
* Captured from the Mcp-Session-Id response header of a handshake-era
|
||||
* server; always null on 2026-07-28, which removed protocol-level sessions
|
||||
* (SEP-2567). A caller that cannot keep the transport alive between
|
||||
* interactions can persist it and pass it back through the constructor's
|
||||
* $headers on a later transport, where it wins over the tracked value.
|
||||
*
|
||||
* @return string|null null until the server mints a session, and again after close()
|
||||
*/
|
||||
public function getSessionId(): ?string
|
||||
{
|
||||
return $this->sessionId;
|
||||
}
|
||||
|
||||
public function send(string $data): void
|
||||
{
|
||||
$request = $this->requestFactory->createRequest('POST', $this->endpoint)
|
||||
|
|
|
|||
Loading…
Reference in a new issue