Skip to content

Commit fe8d981

Browse files
committed
Added basic StructuredContent
1 parent a64e7f9 commit fe8d981

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Schema/Result/CallToolResult.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ public static function fromArray(array $data): self
9898
continue;
9999
}
100100
$contents[] = match ($item->type ?? null) {
101+
// TODO this should be enum, also `resource_link` missing.
102+
// We shouldn't rely on user input for type and just use instanceof instead
101103
'text', 'audio', 'image', 'resource' => $item,
102104
default => throw new InvalidArgumentException(\sprintf('Invalid content type in CallToolResult data: "%s".', $item['type'] ?? null)),
103105
};
@@ -124,9 +126,7 @@ public function jsonSerialize(): array
124126
$result['content'][] = $item->jsonSerialize();
125127
}
126128

127-
$result = [
128-
'isError' => $this->isError,
129-
];
129+
$result['isError'] = $this->isError;
130130

131131
if ($this->structuredContent) {
132132
$result['structuredContent'] = $this->structuredContent->jsonSerialize();

0 commit comments

Comments
 (0)