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