Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix boolean parameter handling in ListRoutes MCP tool #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
systempath wants to merge 2 commits into laravel:main
base: main
Choose a base branch
Loading
from systempath:main

Conversation

Copy link

@systempath systempath commented Sep 28, 2025

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /