Fix McpAIFunction to override Name/Description (#35)
This commit is contained in:
parent
f15b94c244
commit
e5c26d6285
1 changed files with 7 additions and 9 deletions
|
|
@ -23,7 +23,10 @@ public class McpAIFunction : AIFunction
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => _tool.Name;
|
||||
public override string Name => _tool.Name;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string Description => _tool.Description ?? string.Empty;
|
||||
|
||||
/// <inheritdoc/>
|
||||
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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue