-
Couldn't load subscription status.
- Fork 548
Description
Is your feature request related to a problem? Please describe.
Currently, when manually invoking a tool using the Model Context Protocol C# SDK, it's straightforward to include a ProgressToken. For instance:
var result = await client.SendRequestAsync<CallToolResponse>(new JsonRpcRequest()
{
Method = RequestMethods.ToolsCall,
Params = new CallToolRequestParams()
{
Name = progressTool.ProtocolTool.Name,
Meta = new() { ProgressToken = new("abc123") },
},
}, TestContext.Current.CancellationToken);However, when utilizing the IChatClient and passing tools obtained from mcpClient.ListToolsAsync(), as demonstrated in the ChatWithTools sample
| await foreach (var update in chatClient.GetStreamingResponseAsync(messages, new() { Tools = [.. tools] })) |
There doesn't appear to be a method to customize the tool invocation to include a ProgressToken.
Describe the solution you'd like
Introduce a mechanism within the McpClientTool or related classes that allows developers to customize tool invocations, enabling the inclusion of parameters like ProgressToken. This could involve enhancing the McpClientTool class to be more flexible or providing hooks/callbacks to modify tool call parameters before execution.
Describe alternatives you've considered
One alternative could be modifying the McpClientTool class to be non-sealed, allowing developers to inherit from it and create customized implementations that can include the ProgressToken or other parameters as needed.