From a09d452f6e960023676d1bd09e73945686f2c5de Mon Sep 17 00:00:00 2001 From: Kyrian Obikwelu Date: Wed, 25 Jun 2025 05:27:02 +0100 Subject: [PATCH] fix: preserve empty properties as stdClass in Tool::fromArray() --- src/Tool.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Tool.php b/src/Tool.php index ed3077e..ffa3731 100644 --- a/src/Tool.php +++ b/src/Tool.php @@ -67,7 +67,9 @@ public static function fromArray(array $data): static if (!isset($data['inputSchema']['type']) || $data['inputSchema']['type'] !== 'object') { throw new \InvalidArgumentException("Tool inputSchema must be of type 'object'."); } - + if (isset($data['inputSchema']['properties']) && is_array($data['inputSchema']['properties']) && empty($data['inputSchema']['properties'])) { + $data['inputSchema']['properties'] = new \stdClass(); + } return new static( name: $data['name'],