Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/ai/Azure.AI.Agents.Persistent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features Added

### Breaking Changes
- The `trust` parameter for `MCPApproval` constructor was renamed to `requireApproval`.

### Bugs Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write
public partial class MCPApproval
{
public MCPApproval(Azure.AI.Agents.Persistent.MCPApprovalPerTool perToolApproval) { }
public MCPApproval(string trust) { }
public MCPApproval(string requireApproval) { }
public bool AlwaysRequireApproval { get { throw null; } }
public bool NeverRequireApproval { get { throw null; } }
public Azure.AI.Agents.Persistent.MCPApprovalPerTool PerToolApproval { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write
public partial class MCPApproval
{
public MCPApproval(Azure.AI.Agents.Persistent.MCPApprovalPerTool perToolApproval) { }
public MCPApproval(string trust) { }
public MCPApproval(string requireApproval) { }
public bool AlwaysRequireApproval { get { throw null; } }
public bool NeverRequireApproval { get { throw null; } }
public Azure.AI.Agents.Persistent.MCPApprovalPerTool PerToolApproval { get { throw null; } }
Expand Down
10 changes: 5 additions & 5 deletions sdk/ai/Azure.AI.Agents.Persistent/src/Custom/MCPApproval.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public MCPApproval(MCPApprovalPerTool perToolApproval)
/// <summary>
/// Create an instance of an MCPApproval with trust level, equal for all tools.
/// </summary>
/// <param name="trust">The trust level, can be "always" or "never"</param>
public MCPApproval(string trust)
/// <param name="requireApproval">The approval requirement, can be "always" or "never"</param>
public MCPApproval(string requireApproval)
{
if (!string.Equals(trust, ALWAYS) && !string.Equals(trust, NEVER))
throw new ArgumentException($"The parameter \"trust\" may be only \"{ALWAYS}\" or \"{NEVER}\".");
_forAllToolsApproval = trust;
if (!string.Equals(requireApproval, ALWAYS) && !string.Equals(requireApproval, NEVER))
throw new ArgumentException($"The parameter \"requireApproval\" may be only \"{ALWAYS}\" or \"{NEVER}\".");
_forAllToolsApproval = requireApproval;
}
/// <summary>
/// Return true if we do not trust all tools and always need to ask for approval before sending data to server.
Expand Down
3 changes: 1 addition & 2 deletions sdk/ai/Azure.AI.Agents.Persistent/tests/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Hosting.Server;
using NUnit.Framework;

namespace Azure.AI.Agents.Persistent.Tests
Expand Down Expand Up @@ -43,7 +42,7 @@ public void MCPApprovalPerTool()
public void MCPApprovalRaisesString()
{
ArgumentException exc = Assert.Throws<ArgumentException>(() => new MCPApproval("test"));
Assert.That(exc.Message.StartsWith("The parameter \"trust\" may be only \"always\" or \"never\"."), $"Unexpected message {exc.Message}");
Assert.That(exc.Message.StartsWith("The parameter \"requireApproval\" may be only \"always\" or \"never\"."), $"Unexpected message {exc.Message}");
}

[Test]
Expand Down