diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs index 959cc2d4f5..ec70fe3b51 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Toolbox/Program.cs @@ -12,7 +12,7 @@ // (injected automatically by Foundry platform at runtime) // // Optional: -// FOUNDRY_TOOLSET_NAME - Name of the toolset to load (default: my-toolset) +// FOUNDRY_TOOLBOX_NAME - Name of the toolset to load (default: my-toolset) // FOUNDRY_AGENT_NAME - Client name reported to MCP server // FOUNDRY_AGENT_VERSION - Client version reported to MCP server // FOUNDRY_AGENT_TOOLSET_FEATURES - Feature flags sent to Foundry proxy via header @@ -30,7 +30,7 @@ Env.TraversePath().Load(); string endpoint = Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("AZURE_AI_PROJECT_ENDPOINT is not set."); string deploymentName = Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME") ?? "gpt-4o"; -string toolsetName = Environment.GetEnvironmentVariable("FOUNDRY_TOOLSET_NAME") ?? "my-toolset"; +string toolboxName = Environment.GetEnvironmentVariable("FOUNDRY_TOOLBOX_NAME") ?? "my-toolset"; // Use a chained credential: try a temporary dev token first (for local Docker debugging), // then fall back to DefaultAzureCredential (for local dev via dotnet run / managed identity in production). @@ -62,7 +62,7 @@ builder.Services.AddFoundryResponses(agent); // The toolset name must match a toolset registered in your Foundry project. // When FOUNDRY_AGENT_TOOLSET_ENDPOINT is absent (e.g., in local development without Foundry // infrastructure), startup succeeds without error and no toolbox tools are loaded. -builder.Services.AddFoundryToolboxes(toolsetName); +builder.Services.AddFoundryToolboxes(toolboxName); var app = builder.Build(); app.MapFoundryResponses(); diff --git a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/AgentFrameworkResponseHandler.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/AgentFrameworkResponseHandler.cs index be7566d5bb..8dfd395e4c 100644 --- a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/AgentFrameworkResponseHandler.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/AgentFrameworkResponseHandler.cs @@ -170,7 +170,7 @@ public class AgentFrameworkResponseHandler : ResponseHandler { // Emit mcp_approval_request output item + incomplete for the consent URL. foreach (var approvalEvent in stream.OutputItemMcpApprovalRequest( - consentInfo.ToolsetName, + consentInfo.ToolboxName, consentInfo.ToolName, consentInfo.ConsentUrl)) { diff --git a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ConsentAwareMcpClientTool.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ConsentAwareMcpClientAIFunction.cs similarity index 88% rename from dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ConsentAwareMcpClientTool.cs rename to dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ConsentAwareMcpClientAIFunction.cs index 467660756f..5f3ec0ed9b 100644 --- a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ConsentAwareMcpClientTool.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ConsentAwareMcpClientAIFunction.cs @@ -25,15 +25,15 @@ namespace Microsoft.Agents.AI.Foundry.Hosting; /// mcp_approval_request output item and marks the response as incomplete. /// /// -internal sealed class ConsentAwareMcpClientTool : AIFunction +internal sealed class ConsentAwareMcpClientAIFunction : AIFunction { private readonly McpClientTool _inner; - private readonly string _toolsetName; + private readonly string _toolboxName; - internal ConsentAwareMcpClientTool(McpClientTool inner, string toolsetName) + internal ConsentAwareMcpClientAIFunction(McpClientTool inner, string toolboxName) { this._inner = inner; - this._toolsetName = toolsetName; + this._toolboxName = toolboxName; } public override string Name => this._inner.Name; @@ -59,7 +59,7 @@ internal sealed class ConsentAwareMcpClientTool : AIFunction var state = McpConsentContext.Current.Value; if (state is not null) { - state.Pending = new McpConsentInfo(this._toolsetName, this._inner.Name, ex.Message); + state.Pending = new McpConsentInfo(this._toolboxName, this._inner.Name, ex.Message); state.CancellationSource?.Cancel(); } diff --git a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxOptions.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxOptions.cs index dd06a7f3fb..68ae41762e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxOptions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxOptions.cs @@ -10,12 +10,12 @@ namespace Microsoft.Agents.AI.Foundry.Hosting; public sealed class FoundryToolboxOptions { /// - /// Gets the list of toolset names to connect to at startup. - /// Each name corresponds to a toolset registered in the Foundry project. + /// Gets the list of toolbox names to connect to at startup. + /// Each name corresponds to a toolbox registered in the Foundry project. /// The platform proxy URL is constructed as: - /// {FOUNDRY_AGENT_TOOLSET_ENDPOINT}/{toolsetName}/mcp?api-version={ApiVersion} + /// {FOUNDRY_AGENT_TOOLSET_ENDPOINT}/{toolboxName}/mcp?api-version={ApiVersion} /// - public IList ToolsetNames { get; } = new List(); + public IList ToolboxNames { get; } = []; /// /// Gets or sets the Toolsets API version to use when constructing proxy URLs. diff --git a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxService.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxService.cs index 3b96bb8ef0..cd9c736e31 100644 --- a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxService.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/FoundryToolboxService.cs @@ -16,7 +16,7 @@ using ModelContextProtocol.Client; namespace Microsoft.Agents.AI.Foundry.Hosting; /// -/// An that eagerly connects to the Foundry Toolsets MCP proxy at +/// An that eagerly connects to the Foundry Toolboxes MCP proxy at /// container startup, discovers tools via tools/list, and caches them so they can be /// injected into every by /// . @@ -28,7 +28,7 @@ namespace Microsoft.Agents.AI.Foundry.Hosting; /// /// /// Initialization is performed in so the readiness probe is only satisfied -/// after all configured toolsets are connected and their tools discovered (spec §3.1 SHOULD). +/// after all configured toolboxes are connected and their tools discovered (spec §3.1 SHOULD). /// /// public sealed class FoundryToolboxService : IHostedService, IAsyncDisposable @@ -41,8 +41,8 @@ public sealed class FoundryToolboxService : IHostedService, IAsyncDisposable private readonly List _httpClients = []; /// - /// Gets the cached list of instances discovered from all connected toolsets. - /// Always non-null after startup; returns an empty list when no toolset endpoint is configured. + /// Gets the cached list of instances discovered from all connected toolboxes. + /// Always non-null after startup; returns an empty list when no toolbox endpoint is configured. /// public IReadOnlyList Tools { get; private set; } = []; @@ -75,9 +75,9 @@ public sealed class FoundryToolboxService : IHostedService, IAsyncDisposable return; } - if (this._options.ToolsetNames.Count == 0) + if (this._options.ToolboxNames.Count == 0) { - this._logger.LogInformation("No toolset names configured; toolbox support is disabled."); + this._logger.LogInformation("No toolbox names configured; toolbox support is disabled."); this.Tools = []; return; } @@ -88,21 +88,21 @@ public sealed class FoundryToolboxService : IHostedService, IAsyncDisposable var allTools = new List(); - // Deduplicate toolset names to avoid duplicate MCP clients and ambiguous tool exposure + // Deduplicate toolbox names to avoid duplicate MCP clients and ambiguous tool exposure var seen = new HashSet(StringComparer.OrdinalIgnoreCase); - foreach (var toolsetName in this._options.ToolsetNames) + foreach (var toolboxName in this._options.ToolboxNames) { - if (!seen.Add(toolsetName)) + if (!seen.Add(toolboxName)) { continue; } - var proxyUrl = $"{endpoint.TrimEnd('/')}/{toolsetName}/mcp?api-version={this._options.ApiVersion}"; + var proxyUrl = $"{endpoint.TrimEnd('/')}/{toolboxName}/mcp?api-version={this._options.ApiVersion}"; if (this._logger.IsEnabled(LogLevel.Information)) { - this._logger.LogInformation("Connecting to toolset '{ToolsetName}' at {ProxyUrl}.", toolsetName, proxyUrl); + this._logger.LogInformation("Connecting to toolbox '{ToolboxName}' at {ProxyUrl}.", toolboxName, proxyUrl); } try @@ -118,7 +118,7 @@ public sealed class FoundryToolboxService : IHostedService, IAsyncDisposable var transportOptions = new HttpClientTransportOptions { Endpoint = new Uri(proxyUrl), - Name = toolsetName, + Name = toolboxName, }; var transport = new HttpClientTransport(transportOptions, httpClient); @@ -144,22 +144,22 @@ public sealed class FoundryToolboxService : IHostedService, IAsyncDisposable if (this._logger.IsEnabled(LogLevel.Information)) { this._logger.LogInformation( - "Toolset '{ToolsetName}': discovered {ToolCount} tool(s).", - toolsetName, + "Toolbox '{ToolboxName}': discovered {ToolCount} tool(s).", + toolboxName, tools.Count); } foreach (var tool in tools) { - allTools.Add(new ConsentAwareMcpClientTool(tool, toolsetName)); + allTools.Add(new ConsentAwareMcpClientAIFunction(tool, toolboxName)); } } catch (Exception ex) when (ex is not OperationCanceledException) { this._logger.LogError( ex, - "Failed to connect to toolset '{ToolsetName}'. Tools from this toolset will not be available.", - toolsetName); + "Failed to connect to toolbox '{ToolboxName}'. Tools from this toolbox will not be available.", + toolboxName); } } diff --git a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/McpConsentContext.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/McpConsentContext.cs index 4509db95da..aba28a5314 100644 --- a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/McpConsentContext.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/McpConsentContext.cs @@ -8,13 +8,13 @@ namespace Microsoft.Agents.AI.Foundry.Hosting; /// /// Carries OAuth consent information for a single tool call that returned JSON-RPC error -32006. /// -/// The toolset name that owns the tool. +/// The toolbox name that owns the tool. /// Fully-qualified tool name (e.g., logicapps.send_email). /// The OAuth consent URL the user must visit. -internal sealed record McpConsentInfo(string ToolsetName, string ToolName, string ConsentUrl); +internal sealed record McpConsentInfo(string ToolboxName, string ToolName, string ConsentUrl); /// -/// Per-request mutable state shared between (child context) +/// Per-request mutable state shared between (child context) /// and (parent context) via . /// /// @@ -31,7 +31,7 @@ internal sealed class RequestConsentState } /// -/// Thread-static (AsyncLocal) context that enables +/// Thread-static (AsyncLocal) context that enables /// to signal a consent error back to through the /// tool loop. /// diff --git a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ServiceCollectionExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ServiceCollectionExtensions.cs index e95a1a847f..3a924d6899 100644 --- a/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ServiceCollectionExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ServiceCollectionExtensions.cs @@ -100,14 +100,14 @@ public static class FoundryHostingExtensions } /// - /// Registers the Foundry Toolbox service, which eagerly connects to the Foundry Toolsets + /// Registers the Foundry Toolbox service, which eagerly connects to the Foundry Toolboxes /// MCP proxy at startup and provides MCP tools to . /// /// /// - /// Each string in is a toolset name registered in the Foundry - /// project. The proxy URL per toolset is constructed as: - /// {FOUNDRY_AGENT_TOOLSET_ENDPOINT}/{toolsetName}/mcp?api-version=2025-05-01-preview + /// Each string in is a toolbox name registered in the Foundry + /// project. The proxy URL per toolbox is constructed as: + /// {FOUNDRY_AGENT_TOOLSET_ENDPOINT}/{toolboxName}/mcp?api-version=2025-05-01-preview /// /// /// When FOUNDRY_AGENT_TOOLSET_ENDPOINT is absent, startup succeeds without error and @@ -116,26 +116,26 @@ public static class FoundryHostingExtensions /// /// Example: /// - /// builder.Services.AddFoundryToolboxes("my-tools", "another-toolset"); + /// builder.Services.AddFoundryToolboxes("my-toolbox", "another-toolbox"); /// /// /// /// The service collection. - /// Names of the Foundry toolsets to connect to. + /// Names of the Foundry toolboxes to connect to. /// The service collection for chaining. public static IServiceCollection AddFoundryToolboxes( this IServiceCollection services, - params string[] toolsetNames) + params string[] toolboxNames) { ArgumentNullException.ThrowIfNull(services); services.Configure(opt => { - foreach (var name in toolsetNames) + foreach (var name in toolboxNames) { if (!string.IsNullOrWhiteSpace(name)) { - opt.ToolsetNames.Add(name); + opt.ToolboxNames.Add(name); } } });