Conversation
…ype comparison The `executeOperation` and second code path in `McpToolsManager` compared the string `$operationType` against enum cases in `in_array()`, which always returned false in PHP. This caused the `->when()` filter to never execute, so `->first()` always returned the first action in the collection regardless of `operation_name`. Fix: use `$operationTypeEnum` (the already-converted enum) instead of `$operationType` (the raw string) in the `in_array()` check.
PR Summary
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
When calling
execute-operationwithoperation_type=actionandoperation_name=replicate, the wrapper always executes the first action in the list (e.g.,share-invoice) instead of the requested one.Same issue affects the second code path used by action/getter resolution.
Root Cause
McpToolsManager::executeOperation()line 381 compares the raw string$operationType('action') against enum cases (OperationTypeEnum::action) usingin_array(). In PHP, a string never equals an enum case, so the comparison always returnsfalse. The->when()filter never runs, and->first()returns index 0.Note:
getOperationDetails()had the same pattern at line 329 but was already using$operationTypeEnumcorrectly. The two instances fixed here are the second code path at line 378 andexecuteOperationat line 381.Fix
One-character fix in two places:
$operationType->$operationTypeEnum