Skip to content

Conversation

@Daanra
Copy link
Contributor

@Daanra Daanra commented Oct 6, 2025

When defining a Tool that uses a custom Attribute, e.g.:

#[MyCustomAttribute]
class CurrentWeatherTool extends Tool
{
   
}

An exception is thrown:

Laravel\Mcp\Server\Tool::{closure:Laravel\Mcp\Server\Tool::annotations():33}(): Argument #1 ($attribute) must be of type Laravel\Mcp\Server\Contracts\Tools\Annotation, MyCustomAttribute given

This is because Tool::annotations() falsely assumes that all Attributes are of type \Laravel\Mcp\Server\Contracts\Tools\Annotation

This pull request attempts to fix this problem by filtering the Attributes before generating the annotations.

P.S. Great work on this package, it's amazing! 🚀

@taylorotwell taylorotwell merged commit 180776d into laravel:main Oct 6, 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.

2 participants