Skip to content

Commit 8d5360e

Browse files
committed
Fix ResponseFactory::map() method not found error in CallToolWithExecutor
- Call ->responses() first to get Collection before using ->map() and ->contains() - Fixes BadMethodCallException when executing MCP tools - Resolves issue where ResponseFactory was being treated as a Collection
1 parent 7e676d7 commit 8d5360e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Mcp/Methods/CallToolWithExecutor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public function handle(JsonRpcRequest $request, ServerContext $context): JsonRpc
5858
$response = Response::error('Tool execution error: '.$throwable->getMessage());
5959
}
6060

61-
return $this->toJsonRpcResponse($request, $response, fn ($responses): array => [
62-
'content' => $responses->map(fn ($response) => $response->content()->toTool($tool))->all(),
63-
'isError' => $responses->contains(fn ($response) => $response->isError()),
61+
return $this->toJsonRpcResponse($request, $response, fn ($responseFactory): array => [
62+
'content' => $responseFactory->responses()->map(fn ($response) => $response->content()->toTool($tool))->all(),
63+
'isError' => $responseFactory->responses()->contains(fn ($response) => $response->isError()),
6464
]);
6565
}
6666
}

0 commit comments

Comments
 (0)