Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Implementing tools using a dedicated type #100

@colombod

Description

@colombod

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions