refactor: simplify workflow request interpretation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-24 21:29:35 +01:00
co-authored by Copilot
parent 38ebe5bdfa
commit 8b2e7cd2c0
4 changed files with 71 additions and 18 deletions
@@ -0,0 +1,5 @@
using System.Diagnostics.CodeAnalysis;
[assembly: Experimental(
"MEAI001",
UrlFormat = "https://aka.ms/dotnet-extensions-warnings/{0}")]
@@ -31,6 +31,25 @@ public sealed class WorkflowRequestInfoInterpreterTests
Assert.Equal("view", toolNamesByCallId["call-1"]);
}
[Fact]
public void TryCreateActivityFromRequest_MapsMcpToolCalls()
{
ConcurrentDictionary<string, string> toolNamesByCallId = new(StringComparer.Ordinal);
RequestInfoEvent requestInfo = CreateRequestInfoEvent(
CreateMcpToolCall("call-1", "git.status", "Git MCP"));
AgentActivityEventDto? activity = WorkflowRequestInfoInterpreter.TryCreateActivityFromRequest(
CreateSingleAgentCommand(),
requestInfo,
new AgentIdentity("agent-1", "Primary"),
toolNamesByCallId);
Assert.NotNull(activity);
Assert.Equal("tool-calling", activity.ActivityType);
Assert.Equal("git.status", activity.ToolName);
Assert.Equal("git.status", toolNamesByCallId["call-1"]);
}
[Fact]
public void TryCreateActivityFromRequest_MapsCodeInterpreterCallsToSyntheticToolName()
{
@@ -159,6 +178,14 @@ public sealed class WorkflowRequestInfoInterpreterTests
return instance;
}
private static object CreateMcpToolCall(string callId, string toolName, string serverName)
{
Type type = Type.GetType(
"Microsoft.Extensions.AI.McpServerToolCallContent, Microsoft.Extensions.AI.Abstractions",
throwOnError: true)!;
return Activator.CreateInstance(type, callId, toolName, serverName)!;
}
private static object CreateImageGenerationToolCall()
{
Type type = Type.GetType(