Skip to content

Implementing tools using a dedicated type #26

Closed

Description

@eiriktsarpalis

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.

Activity

  1. self-assigned this
    on Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions