Skip to content

Commit 992cc77

Browse files
Fix CallToolWithExecutor Error (#359)
* 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 * Revert "Fix ResponseFactory::map() method not found error in CallToolWithExecutor" This reverts commit 8d5360e. * 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 * Add comprehensive tests for CallToolWithExecutor fix - Add 5 test cases covering ResponseFactory fix - Tests verify ->responses()->map() works correctly - Tests cover error handling and validation - Add PR description document * Remove PR description file from repository * Remove Unnecessary Test Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Bump minimum mcp package Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> --------- Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> Co-authored-by: Pushpak Chhajed <pushpak1300@gmail.com>
1 parent 7e676d7 commit 992cc77

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"illuminate/contracts": "^10.49.0|^11.45.3|^12.28.1",
2020
"illuminate/routing": "^10.49.0|^11.45.3|^12.28.1",
2121
"illuminate/support": "^10.49.0|^11.45.3|^12.28.1",
22-
"laravel/mcp": "^0.3.2",
22+
"laravel/mcp": "^0.3.4",
2323
"laravel/prompts": "0.1.25|^0.3.6",
2424
"laravel/roster": "^0.2.9"
2525
},

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)