fix: return tool errors for auth failures#186
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
0840382 to
eaec695
Compare
|
Follow-up note: after opening this PR I also fixed the unrelated Passport/phpstan noise in |
|
Follow-up note: after the latest rebase, this branch is now back to a clean merge state. The Rector/phpstan noise in |
|
Follow-up note: the latest PHPStan / Rector-compatible Passport lookup fix is now pushed on top of the current branch head as |
3037d99 to
3958f4d
Compare
Summary
AuthenticationExceptionorAuthorizationExceptiontools/calltransport alive so end users get a normal tool error response instead of an unhandled server failureEnd-user benefit
When a tool is protected by Laravel auth or authorization rules, the MCP client now receives a structured tool error message it can display to the user. That means clients can explain "you need to sign in" or "you are not allowed to run this tool" instead of seeing the tool call collapse with a generic transport error.
Testing
./vendor/bin/pest tests/Unit/Methods/CallToolTest.php./vendor/bin/pint --test src/Server/Methods/CallTool.php tests/Unit/Methods/CallToolTest.php