diff --git a/src/McpDotNet.Extensions.AI/McpAIFunction.cs b/src/McpDotNet.Extensions.AI/McpAIFunction.cs index 35bb445..4829052 100644 --- a/src/McpDotNet.Extensions.AI/McpAIFunction.cs +++ b/src/McpDotNet.Extensions.AI/McpAIFunction.cs @@ -23,7 +23,10 @@ public class McpAIFunction : AIFunction } /// - public override string ToString() => _tool.Name; + public override string Name => _tool.Name; + + /// + public override string Description => _tool.Description ?? string.Empty; /// public override JsonElement JsonSchema => AIFunctionUtilities.MapToJsonElement(_tool); @@ -42,14 +45,9 @@ public class McpAIFunction : AIFunction } // Call the tool through mcpdotnet - var result = await _client.CallToolAsync( - _tool.Name, - argDict.Count == 0 ? [] : argDict, - cancellationToken: cancellationToken - ); + var result = await _client.CallToolAsync(_tool.Name, argDict, cancellationToken); - // Extract the text content from the result - // For simplicity in this sample, we'll just concatenate all text content + // Extract the text content from the result. return string.Join("\n", result.Content .Where(c => c.Type == "text") .Select(c => c.Text));