File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
tests/Unit/Server/Handler/Request Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -109,9 +109,15 @@ public static function fromArray(array $data): self
109109 */
110110 public function jsonSerialize (): array
111111 {
112- return [
112+ $ result = [
113113 'content ' => $ this ->content ,
114114 'isError ' => $ this ->isError ,
115115 ];
116+
117+ if ($ this ->structuredContent ) {
118+ $ result ['structuredContent ' ] = $ this ->structuredContent ;
119+ }
120+
121+ return $ result ;
116122 }
117123}
Original file line number Diff line number Diff line change @@ -368,6 +368,7 @@ public function testHandleReturnsStructuredContentResult(): void
368368
369369 $ this ->assertInstanceOf (Response::class, $ response );
370370 $ this ->assertSame ($ structuredResult , $ response ->result );
371+ $ this ->assertEquals (['result ' => 'Rendered results ' ], $ response ->result ->jsonSerialize ()['structuredContent ' ] ?? []);
371372 }
372373
373374 public function testHandleReturnsCallToolResult (): void
@@ -396,6 +397,7 @@ public function testHandleReturnsCallToolResult(): void
396397
397398 $ this ->assertInstanceOf (Response::class, $ response );
398399 $ this ->assertSame ($ callToolResult , $ response ->result );
400+ $ this ->assertArrayNotHasKey ('structuredContent ' , $ response ->result ->jsonSerialize ());
399401 }
400402
401403 /**
You can’t perform that action at this time.
0 commit comments