MCP PHP SDK

InitializeHandler implements RequestHandlerInterface

FinalYes
Tags
author

Christopher Hertel mail@christopher-hertel.de

Table of Contents

Interfaces

RequestHandlerInterface
Covariant in TResult: a handler only ever produces its result, so one declaring a concrete result type satisfies a collection of handlers typed by the interface every result implements.

Properties

$configuration  : Configuration|null

Methods

__construct()  : mixed
handle()  : Response<string|int, InitializeResult>
supports()  : bool
negotiate()  : ProtocolVersion
Picks the protocol version to answer an `initialize` handshake with.
supportedVersions()  : array<int, ProtocolVersion>
Versions this server is willing to negotiate over `initialize`.

Properties

Methods

negotiate()

Picks the protocol version to answer an `initialize` handshake with.

private negotiate(string $requested) : ProtocolVersion

If the client asked for a version this server supports, the spec requires responding with that exact version. Otherwise the server counter-offers the newest version it does support and leaves it to the client to decide whether it can continue on that revision or must disconnect.

Parameters
$requested : string
Return values
ProtocolVersion

supportedVersions()

Versions this server is willing to negotiate over `initialize`.

private supportedVersions() : array<int, ProtocolVersion>

A version configured on the server pins the handshake to exactly that revision. Modern revisions are never offered here: they have no initialize at all, so a client that reached this handler cannot speak one, and answering with it would leave the connection unusable.

Return values
array<int, ProtocolVersion>
On this page

Search results