diff --git a/core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs b/core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs index 237144335b..4216350274 100644 --- a/core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs +++ b/core/Azure.Mcp.Core/src/Areas/Server/Commands/ToolLoading/RegistryToolLoader.cs @@ -122,7 +122,7 @@ public override async ValueTask CallToolHandler(RequestContext + /// Gets all of the 's available in the server. + /// + /// A JSON serialized string with each area's name and a description of operations available in + /// that namespace. private async Task GetRootToolsJsonAsync() { if (_cachedRootToolsJson != null) @@ -187,6 +192,12 @@ private async Task GetRootToolsJsonAsync() return toolsJson; } + /// + /// Gets the set of within an . + /// + /// Calling request + /// Name of the to get commands for. + /// JSON serialized string representing the list of commands available in the tool's area. private async Task GetToolListJsonAsync(RequestContext request, string tool) { if (_cachedToolListsJson.TryGetValue(tool, out var cachedJson)) @@ -236,7 +247,10 @@ Here are the available list of tools. private async Task ToolLearnModeAsync(RequestContext request, string intent, string tool, CancellationToken cancellationToken) { - Activity.Current?.SetTag(TagName.IsServerCommandInvoked, false); + var activity = Activity.Current? + .SetTag(TagName.IsServerCommandInvoked, false) + .SetTag(TagName.ToolArea, tool); + var toolsJson = await GetToolListJsonAsync(request, tool); if (string.IsNullOrEmpty(toolsJson)) { @@ -273,7 +287,6 @@ private async Task ToolLearnModeAsync(RequestContext CommandModeAsync(RequestContext request, string intent, string tool, string command, Dictionary parameters, CancellationToken cancellationToken) { - Activity.Current?.SetTag(TagName.IsServerCommandInvoked, true); McpClient? client; try @@ -292,6 +305,14 @@ private async Task CommandModeAsync(RequestContext