Skip to content

Commit de8a32e

Browse files
fix: preserve empty properties as stdClass in Tool::fromArray()
1 parent 15d5466 commit de8a32e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Tool.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ public static function fromArray(array $data): static
6767
if (!isset($data['inputSchema']['type']) || $data['inputSchema']['type'] !== 'object') {
6868
throw new \InvalidArgumentException("Tool inputSchema must be of type 'object'.");
6969
}
70-
70+
if (isset($data['inputSchema']['properties']) && is_array($data['inputSchema']['properties']) && empty($data['inputSchema']['properties'])) {
71+
$data['inputSchema']['properties'] = new \stdClass();
72+
}
7173

7274
return new static(
7375
name: $data['name'],

0 commit comments

Comments
 (0)