Bump Azure.AI.Projects to 2.1.0-alpha; add ToolboxRecord/ToolboxVersion factory overloads + tests

This commit is contained in:
Roger Barreto
2026-04-17 23:34:51 +01:00
parent 215a0ad473
commit acf8fa47c1
4 changed files with 108 additions and 9 deletions
@@ -119,17 +119,43 @@ public static class FoundryAITool
/// <param name="toolboxName">The Foundry toolbox name.</param>
/// <param name="version">Optional pinned toolbox version. When <see langword="null"/>, the project's default version is used.</param>
/// <returns>An <see cref="AITool"/> marker backed by <see cref="HostedMcpToolboxAITool"/>.</returns>
/// <remarks>
/// <para>
/// Consumers who already hold a <c>ToolboxRecord</c> or <c>ToolboxVersion</c> from
/// <c>Azure.AI.Projects.Agents</c> can pass <c>record.Name</c> together with
/// <c>record.DefaultVersion</c> (or <c>version.Name</c>/<c>version.Version</c>) to this
/// factory.
/// </para>
/// </remarks>
public static AITool CreateHostedMcpToolbox(string toolboxName, string? version = null)
=> new HostedMcpToolboxAITool(toolboxName, version);
/// <summary>
/// Creates an <see cref="AITool"/> marker from a <see cref="ToolboxRecord"/> retrieved
/// from <c>AIProjectClient</c>. Uses <see cref="ToolboxRecord.Name"/> and
/// <see cref="ToolboxRecord.DefaultVersion"/>.
/// </summary>
/// <param name="toolbox">The toolbox record.</param>
/// <returns>An <see cref="AITool"/> marker backed by <see cref="HostedMcpToolboxAITool"/>.</returns>
public static AITool CreateHostedMcpToolbox(ToolboxRecord toolbox)
{
if (toolbox is null)
{
throw new ArgumentNullException(nameof(toolbox));
}
return new HostedMcpToolboxAITool(toolbox.Name, toolbox.DefaultVersion);
}
/// <summary>
/// Creates an <see cref="AITool"/> marker from a specific <see cref="ToolboxVersion"/>
/// retrieved from <c>AIProjectClient</c>. Uses <see cref="ToolboxVersion.Name"/> and
/// <see cref="ToolboxVersion.Version"/>.
/// </summary>
/// <param name="toolboxVersion">The toolbox version.</param>
/// <returns>An <see cref="AITool"/> marker backed by <see cref="HostedMcpToolboxAITool"/>.</returns>
public static AITool CreateHostedMcpToolbox(ToolboxVersion toolboxVersion)
{
if (toolboxVersion is null)
{
throw new ArgumentNullException(nameof(toolboxVersion));
}
return new HostedMcpToolboxAITool(toolboxVersion.Name, toolboxVersion.Version);
}
// --- OpenAI SDK ResponseTool factories ---
/// <summary>