Skip to content

Implementing tools using a dedicated type #26

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

Closed
eiriktsarpalis opened this issue Mar 21, 2025 · 0 comments · Fixed by #89
Closed

Implementing tools using a dedicated type #26

eiriktsarpalis opened this issue Mar 21, 2025 · 0 comments · Fixed by #89
Assignees

Comments

@eiriktsarpalis
Copy link
Contributor

Originally posted by @colombod in PederHP/mcpdotnet#100.

The MCP protocol allows for tool collection to change over time (see the specs here).

With the current state of this project users will have to override the behaviour of the ListToolsHandler and also write code to keep the list of tools consistent. This will introduce a lot of overhead when the goal is to allow for some tool to be removed from the capability list. It would be also required to write code to notify clients about the tool availability changes.

The message flow to implement will be up to the tool developer.

Image

Using a more specific type

public abstract class McpTool {
 public  ToolDescriptor Descriptor {get;}
 public Availability Availability {get; }
 protected void SetAvailability(Availability availability){}
 internal Action<Availability> OnAvailabilityChanged {get;}

The McpServer could implement the message flow and listing functionality in a consistent way for all tool implementation.
A developer would need to use this type only when requiring advanced functionalities for tool availability changes, in any other cases the current offer via custom attributes would be fine.

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 a pull request may close this issue.

2 participants