| 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\Tool\ToolSchema; |
| 15: | |
| 16: | /** |
| 17: | * The `null` type is used to validate the `null` value. |
| 18: | * |
| 19: | * @extends ToolSchema<null, array{ |
| 20: | * type: 'null', |
| 21: | * description?: non-empty-string, |
| 22: | * title?: non-empty-string, |
| 23: | * }> |
| 24: | */ |
| 25: | final class NullType extends ToolSchema |
| 26: | { |
| 27: | #[\Override] |
| 28: | public function toArray(): array |
| 29: | { |
| 30: | return array_filter([ |
| 31: | 'type' => 'null', |
| 32: | 'description' => $this->description, |
| 33: | 'title' => $this->title, |
| 34: | ], static fn(mixed $value): bool => null !== $value); |
| 35: | } |
| 36: | } |
| 37: |