-
Notifications
You must be signed in to change notification settings - Fork 235
Non-static classes and methods are not picked up by WithTools() #79
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
Comments
Thanks. We'll fix the sample. The scenario will soon be supported, once a new build of Microsoft.Extensions.AI is picked up. At that point, [McpTool]s will be able to specify tool arguments like IServerProvider, IMcpServer, etc., and they'll be supplied from DI / the surrounding context. We currently do not plan to enable to enable [McpTool] to work with instance methods. Whatever the receiver type would have been can instead be fetched from DI via an argument. |
@stephentoub I like the speed of this. Let me know if/when I can do some checking. |
Based on multiple folks asking for it, instance support has now been added. It'll be in the next build (should be published to nuget this week), but you can also build from source to get it immediately. Feedback welcome. |
@stephentoub Yes, builded from source yesterday and this works now. |
Non-static classes and methods that are correctly decortated with the [McpToolType] and [McpTool] attribute classes are not picked up. The sample in AspNetCoreSseServer\Tools\SampleLlmTool doesn't seem to work because of this issue. The comment in this class noted "This tool uses depenency injection and async method" - suggesting support for non-static classes and methods.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
You would expect the tool SampleLLM to appear.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: