Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Agents/ConfigurableAgentsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ public static class ConfigurableAgentsExtensions
if (toolMethod.GetCustomAttribute<McpServerToolAttribute>() is { } toolAttribute)
{
var function = toolMethod.IsStatic
? AIFunctionFactory.Create(toolMethod, null, toolAttribute.Name ?? ToolJsonOptions.Default.PropertyNamingPolicy!.ConvertName(toolMethod.Name))
? AIFunctionFactory.Create(toolMethod, null,
toolAttribute.Name ?? ToolJsonOptions.Default.PropertyNamingPolicy!.ConvertName(toolMethod.Name),
serializerOptions: serializerOptions)
: AIFunctionFactory.Create(toolMethod, args => args.Services?.GetRequiredService(typeof(TToolType)) ??
throw new InvalidOperationException("Could not determine target instance for tool."),
new AIFunctionFactoryOptions { Name = toolAttribute.Name ?? ToolJsonOptions.Default.PropertyNamingPolicy!.ConvertName(toolMethod.Name) });
new AIFunctionFactoryOptions
{
Name = toolAttribute.Name ?? ToolJsonOptions.Default.PropertyNamingPolicy!.ConvertName(toolMethod.Name),
SerializerOptions = serializerOptions
});

builder.Services.TryAdd(ServiceDescriptor.DescribeKeyed(
typeof(AIFunction), function.Name,
Expand Down
Loading