> */ public \WP_REST_Request $request; /** * The HTTP method of the request. * * @var string */ public string $method; /** * The Mcp-Session-Id header from the request. * * @var string|null */ public ?string $session_id; /** * The JSON-decoded body of the request. * * @var array|null */ public ?array $body; /** * The MCP-Protocol-Version header from the request. * * @since 0.5.0 * * @var string|null */ public ?string $protocol_version; /** * The Accept header from the request. * * @var string|null */ public ?string $accept_header; /** * Constructor. * * @param \WP_REST_Request> $request The original request object. */ public function __construct( \WP_REST_Request $request ) { $this->request = $request; $this->method = $request->get_method(); $this->session_id = $request->get_header( 'Mcp-Session-Id' ); $this->protocol_version = $request->get_header( 'Mcp-Protocol-Version' ); $this->accept_header = $request->get_header( 'accept' ); $this->body = 'POST' === $this->method ? $request->get_json_params() : null; } }