diff --git a/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs b/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs index 46eef141..08c38b6b 100644 --- a/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs +++ b/src/Infrastructure/BotSharp.Core.MCP/Hooks/MCPToolAgentHook.cs @@ -28,7 +28,7 @@ public class McpToolAgentHook : AgentHookBase agent.SecondaryFunctions ??= []; var functions = GetMcpContent(agent).Result; - agent.SecondaryFunctions = agent.SecondaryFunctions.Concat(functions).DistinctBy(x => x.Name).ToList(); + agent.SecondaryFunctions = agent.SecondaryFunctions.Concat(functions).DistinctBy(x => x.Name, StringComparer.OrdinalIgnoreCase).ToList(); } private async Task> GetMcpContent(Agent agent) diff --git a/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs b/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs index 359b6e4e..10fa376c 100644 --- a/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs +++ b/src/Infrastructure/BotSharp.Core/Agents/Hooks/BasicAgentHook.cs @@ -25,12 +25,13 @@ public class BasicAgentHook : AgentHookBase var (functions, templates) = GetUtilityContent(agent); - agent.SecondaryFunctions = agent.SecondaryFunctions.Concat(functions).DistinctBy(x => x.Name).ToList(); - agent.SecondaryInstructions = agent.SecondaryInstructions.Concat(templates).Distinct().ToList(); + agent.SecondaryFunctions = agent.SecondaryFunctions.Concat(functions).DistinctBy(x => x.Name, StringComparer.OrdinalIgnoreCase).ToList(); + var contents = templates.Select(x => x.Content); + agent.SecondaryInstructions = agent.SecondaryInstructions.Concat(contents).Distinct(StringComparer.OrdinalIgnoreCase).ToList(); } - private (IEnumerable, IEnumerable) GetUtilityContent(Agent agent) + private (IEnumerable, IEnumerable) GetUtilityContent(Agent agent) { var db = _services.GetRequiredService(); var (functionNames, templateNames) = GetUniqueContent(agent.Utilities); @@ -50,7 +51,7 @@ public class BasicAgentHook : AgentHookBase var ua = db.GetAgent(BuiltInAgentId.UtilityAssistant); var functions = ua?.Functions?.Where(x => functionNames.Contains(x.Name, StringComparer.OrdinalIgnoreCase))?.ToList() ?? []; - var templates = ua?.Templates?.Where(x => templateNames.Contains(x.Name, StringComparer.OrdinalIgnoreCase))?.Select(x => x.Content)?.ToList() ?? []; + var templates = ua?.Templates?.Where(x => templateNames.Contains(x.Name, StringComparer.OrdinalIgnoreCase))?.ToList() ?? []; return (functions, templates); } diff --git a/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs index e5f9c0bb..9d7df9a0 100644 --- a/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs +++ b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs @@ -167,6 +167,12 @@ public class TwilioInboundController : TwilioController new("twilio_call_sid", request.CallSid), }; + if (request.Direction == "inbound") + { + states.Add(new MessageState("calling_phone_from", request.From)); + states.Add(new MessageState("calling_phone_to", request.To)); + } + var requestStates = ParseStates(request.States); foreach (var s in requestStates) {