1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * This file is part of the Nexus MCP SDK package.
7: *
8: * (c) 2026 John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9: *
10: * For the full copyright and license information, please view
11: * the LICENSE file that was distributed with this source code.
12: */
13:
14: namespace Nexus\Mcp\Core\Schema\RequestParams;
15:
16: use Nexus\Assert\Assert;
17: use Nexus\Mcp\Core\Schema\RequestMetaObject;
18: use Nexus\Mcp\Core\Schema\RequestParams;
19: use Nexus\Mcp\Core\Schema\Result\InputResponse;
20:
21: /**
22: * Request params that may carry the client's responses to a prior
23: * `InputRequiredResult` plus the opaque request-state continuation token.
24: *
25: * @template-covariant T of array<string, mixed>
26: *
27: * @extends RequestParams<T>
28: *
29: * @see https://modelcontextprotocol.io/specification/draft/schema#inputresponserequestparams
30: */
31: abstract readonly class InputResponseRequestParams extends RequestParams
32: {
33: /**
34: * @var null|array<string, InputResponse>
35: */
36: public ?array $inputResponses;
37:
38: /**
39: * @param null|array<string, InputResponse> $inputResponses
40: */
41: public function __construct(
42: ?array $inputResponses,
43: public ?string $requestState,
44: RequestMetaObject $meta,
45: ) {
46: $inputResponses = [] === $inputResponses ? null : $inputResponses;
47:
48: if (null !== $inputResponses) {
49: Assert::that($inputResponses)
50: ->isMap('"params.inputResponses" must be a string-keyed object.')
51: ->values()
52: ->isInstanceOf(InputResponse::class, 'each "params.inputResponses" entry must be an InputResponse, {type} given.')
53: ;
54: }
55:
56: $this->inputResponses = $inputResponses;
57:
58: parent::__construct(meta: $meta);
59: }
60: }
61: