| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | /** |
| 6: | * This file is part of the Nexus MCP SDK package. |
| 7: | * |
| 8: | * (c) 2025 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\Schema\Request; |
| 15: | |
| 16: | use Nexus\Mcp\Schema\Message\Message; |
| 17: | |
| 18: | /** |
| 19: | * The base JSON-RPC request object. |
| 20: | * |
| 21: | * @template T of array{method: non-empty-string, params?: array<string, mixed>} |
| 22: | * |
| 23: | * @extends Message<T> |
| 24: | */ |
| 25: | abstract readonly class Request extends Message |
| 26: | { |
| 27: | /** |
| 28: | * @param non-empty-string $method JSON-RPC request method. |
| 29: | * @param null|array<string, mixed> $params Additional request parameters. |
| 30: | */ |
| 31: | public function __construct( |
| 32: | public string $method, |
| 33: | public ?array $params = null, |
| 34: | ) {} |
| 35: | |
| 36: | #[\Override] |
| 37: | public function jsonSerialize(): array |
| 38: | { |
| 39: | return $this->toArray(); |
| 40: | } |
| 41: | } |
| 42: |