Skip to content

Commit 498718c

Browse files
committed
wip
1 parent d424c2d commit 498718c

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/Mcp/Resources/ApplicationInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(protected ToolExecutor $toolExecutor)
3434
/**
3535
* Handle the resource request.
3636
*/
37-
public function handle(Request $request): Response
37+
public function handle(): Response
3838
{
3939
$response = $this->toolExecutor->execute(ApplicationInfoTool::class);
4040

src/Mcp/ToolExecutor.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected function executeInSubprocess(string $toolClass, array $arguments): Res
5555
return Response::error('Invalid JSON output from tool process: '.json_last_error_msg());
5656
}
5757

58-
return $this->reconstructToolResult($decoded);
58+
return $this->reconstructResponse($decoded);
5959
} catch (ProcessTimedOutException $e) {
6060
$process->stop();
6161

@@ -80,20 +80,15 @@ protected function getTimeout(array $arguments): int
8080
*
8181
* @param array<string, mixed> $data
8282
*/
83-
protected function reconstructToolResult(array $data): Response
83+
protected function reconstructResponse(array $data): Response
8484
{
8585
if (! isset($data['isError']) || ! isset($data['content'])) {
86-
return Response::error('Invalid tool result format');
86+
return Response::error('Invalid tool response format.');
8787
}
8888

8989
if ($data['isError']) {
90-
// Content can be either a string or array format
91-
if (is_string($data['content'])) {
92-
return Response::error($data['content']);
93-
}
94-
95-
// Extract the actual text content from the content array
9690
$errorText = 'Unknown error';
91+
9792
if (is_array($data['content']) && ! empty($data['content'])) {
9893
$firstContent = $data['content'][0] ?? [];
9994
if (is_array($firstContent)) {

0 commit comments

Comments
 (0)