Looking for hints on how to redefine/reload available tools at runtime #1244
Replies: 2 comments
-
|
I have found this: _mcpserver.SendNotificationAsync(NotificationMethods.ToolListChangedNotification); But, how can i get McpServer in a controller with DI ? Please help! |
Beta Was this translation helpful? Give feedback.
-
|
I've discovered that you can use DI by accessing ServiceProvider directly from your controller: Then you can retrieve where needed MCP server options:
Using mcpOptions you have access to the ToolCollection, and removing/adding items there the toollistchange event is supposedly automatically raised.
Unfortunately, despite McpInspector receive the notification, clients like Claude Desktop seem not to receive this event, and continue to see previous tools. SO i assume this behaviour is not pretty standardizen or well accepted by mainstream clients that are MCP aware.. Is my approach the right one to dynamically change tool definitions at runtime after the server has being built ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Question Category
Your Question
Suppose tools are defined as plugins, and while the MCP server is running someone is adding a new tool pugin.
What method should i call to inform clients that a new tool has been added/modified ?
Also, how to modify at runtime existing tools. Any example available ?
Paolo Marani
Beta Was this translation helpful? Give feedback.
All reactions