Skip to content

Conversation

@systempath
Copy link
Contributor

Summary

Fixes a type error when using boolean parameters (except_vendor, only_vendor) with the ListRoutes
MCP tool.

Problem

The tool was calling str_replace() on boolean values, causing this error:
str_replace(): Argument #3 ($subject) must be of type array|string, true given

Solution

Added type checking before string manipulation in src/Mcp/Tools/ListRoutes.php:

  • Boolean values are passed through directly
  • String values continue to have wildcards sanitized

Testing

  • except_vendor => true now works correctly
  • String parameters like method => "POST" still work as before
  • No breaking changes

systempath and others added 3 commits September 28, 2025 07:55
The ListRoutes tool was throwing a type error when boolean parameters
(except_vendor, only_vendor) were passed because str_replace() was
being called on boolean values. This fix adds type checking to handle
boolean parameters separately from string parameters.

The error was: "str_replace(): Argument laravel#3 ($subject) must be of type
array|string, true given"

Boolean parameters are now properly passed to the artisan command
without string manipulation, while string parameters continue to have
wildcard characters sanitized.
The ListRoutes tool was throwing a type error when boolean parameters
(except_vendor, only_vendor) were passed because str_replace() was
being called on boolean values. This fix adds type checking to handle
boolean parameters separately from string parameters.

The error was: "str_replace(): Argument laravel#3 ($subject) must be of type
array|string, true given"

Boolean parameters are now properly passed to the artisan command
without string manipulation, while string parameters continue to have
wildcard characters sanitized.
@taylorotwell taylorotwell merged commit 8fcbb99 into laravel:main Oct 14, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants