Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

Address Review Feedback - All Comments Resolved ✅

All new review comments have been addressed:

Documentation Changes

  1. FunctionApprovalRequestContent - Reverted parameter documentation from "requires user approval" back to "requires approval"
  2. FunctionApprovalResponseContent - Reverted parameter documentation from "requires user approval" back to "for which approval was requested"
  3. ✅ Reverted CreateResponse documentation from "function call" back to "call"

Constructor Changes

  1. McpServerToolCallContent - Removed arguments: null parameter from base constructor call

JSON Serialization Changes

  1. ✅ Changed all deserializations from IReadOnlyDictionaryStringObject to IDictionaryStringObject:

    • Line 212: McpToolCallApprovalRequestItem deserialization
    • Line 426: McpToolCallApprovalRequestItem streaming deserialization
    • Line 1298: AddMcpToolCallContent deserialization
  2. ✅ Changed all serializations to use IDictionaryStringObject:

    • Line 1083: McpServerToolCallContent Arguments serialization
    • Line 1096: FunctionCallContent Arguments serialization (changed from AIJsonUtilities to OpenAIJsonContext)

FunctionInvokingChatClient Changes

  1. ✅ Reverted error message from "CallId(s)" back to "FunctionCall.CallId(s)"
  2. ✅ Simplified ApprovalResultWithRequestMessage struct - removed XML doc comment since we're using concrete FunctionCallContent type

All changes maintain the breaking changes we accepted (using IDictionary instead of IReadOnlyDictionary) while simplifying the code.

Original prompt

Can you take over #7104, augment it with implementing McpServerToolCallContent and McpServerToolResultContent by unsealing and extending FunctionCallContent and FunctionResultContent, add the necessary compatibility suppressions, update the branch and resolve conflicts.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Microsoft Reviewers: Open in CodeFlow

Copilot AI and others added 6 commits January 12, 2026 19:11
Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
…ew approval types

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
…ypes

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement McpServerToolCallContent and McpServerToolResultContent Unseal FunctionCallContent/FunctionResultContent; make MCP types extend them Jan 12, 2026
Copilot AI requested a review from jozkee January 12, 2026 19:39
Copy link
Member

@jozkee jozkee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please fix errors and address feedback.

@dotnet-policy-service dotnet-policy-service bot added the waiting-author-feedback 📭 The author of this issue needs to respond in order for us to continue investigating this issue. label Jan 12, 2026
…nts properties, fix idToContentMapping

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback 📭 The author of this issue needs to respond in order for us to continue investigating this issue. label Jan 12, 2026
Copilot AI and others added 2 commits January 12, 2026 22:01
Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
…Dictionary, use Result instead of Output

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 12, 2026

@copilot please fix errors and address feedback.

All feedback addressed in commits 598f78b, 23d5d20, and 29454f9. Changes include:

  • Reverted to FunctionCallContent FunctionCall in approval types
  • Removed wrapper properties from MCP types (breaking changes accepted)
  • Fixed idToContentMapping type and simplified logic
  • Added missing tests from PR Replace Mcp approvals with Function approvals #7104
  • Fixed all build errors (unused usings, type conversions, property renames)

Copilot AI requested a review from jozkee January 12, 2026 22:19

/// <summary>
/// Represents a request for user approval of a function call.
/// Represents a request for user approval of a call content.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this must be reverted too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Reverted parameter documentation from "requires user approval" back to "requires approval".


/// <summary>
/// Represents a response to a function approval request.
/// Represents a response to an approval request.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Reverted parameter documentation from "requires user approval" back to "for which approval was requested".

/// <exception cref="ArgumentException"><paramref name="callId"/> or <paramref name="toolName"/> is empty or composed entirely of whitespace.</exception>
[JsonConstructor]
public McpServerToolCallContent(string callId, string toolName, string? serverName)
: base(callId, toolName, arguments: null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Removed arguments: null parameter from base constructor call.

message.Contents.Add(new FunctionApprovalRequestContent(mtcari.Id, new McpServerToolCallContent(mtcari.Id, mtcari.ToolName, mtcari.ServerLabel)
{
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject)!,
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject) as IDictionary<string, object?>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Suggested change
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject) as IDictionary<string, object?>,
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments, OpenAIJsonContext.Default.IDictionaryStringObject),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Changed to use OpenAIJsonContext.Default.IDictionaryStringObject and removed .ToMemory().Span and cast.

yield return CreateUpdate(new FunctionApprovalRequestContent(mtcari.Id, new McpServerToolCallContent(mtcari.Id, mtcari.ToolName, mtcari.ServerLabel)
{
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject)!,
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject) as IDictionary<string, object?>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Suggested change
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject) as IDictionary<string, object?>,
Arguments = JsonSerializer.Deserialize(mtcari.ToolArguments, OpenAIJsonContext.Default.IDictionaryStringObject),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Changed to use OpenAIJsonContext.Default.IDictionaryStringObject and removed .ToMemory().Span and cast.

mcpCall.CallId,
mcpCall.ServerName,
mcpCall.ToolName,
BinaryData.FromBytes(JsonSerializer.SerializeToUtf8Bytes(mcpCall.Arguments!, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this should serialize as IDictionary<string,object?>, use the same pattern as case FunctionCallContent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Changed to serialize using OpenAIJsonContext.Default.IDictionaryStringObject.

callContent.Name,
BinaryData.FromBytes(JsonSerializer.SerializeToUtf8Bytes(
callContent.Arguments,
AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(IDictionary<string, object?>)))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can this use OpenAIJsonContext.Default.IDictionaryStringObject?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Changed from AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(IDictionary<string, object?>)) to OpenAIJsonContext.Default.IDictionaryStringObject.

contents.Add(new McpServerToolCallContent(mtci.Id, mtci.ToolName, mtci.ServerLabel)
{
Arguments = JsonSerializer.Deserialize(mtci.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject)!,
Arguments = JsonSerializer.Deserialize(mtci.ToolArguments.ToMemory().Span, OpenAIJsonContext.Default.IReadOnlyDictionaryStringObject) as IDictionary<string, object?>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot deserialize as IDictionary<string,object?>, use JsonSerializer.Deserialize(utf8json, OpenAIJsonContext.Default.IDictionaryStringObject).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Changed to deserialize using OpenAIJsonContext.Default.IDictionaryStringObject and removed .ToMemory().Span and cast.

{
Throw.InvalidOperationException(
$"FunctionApprovalRequestContent found with FunctionCall.CallId(s) '{string.Join(", ", approvalRequestCallIds)}' that have no matching FunctionApprovalResponseContent.");
$"FunctionApprovalRequestContent found with CallId(s) '{string.Join(", ", approvalRequestCallIds)}' that have no matching FunctionApprovalResponseContent.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot undo this since we no longer need to change the property name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Reverted error message from "CallId(s)" back to "FunctionCall.CallId(s)".

/// <summary>
/// Gets the FunctionCallContent from the response.
/// </summary>
public FunctionCallContent FunctionCallContent => Response.FunctionCall;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot we can also undo this since we reverted FunctionApprovalResponseContent.FunctionCall to keep using concrete FunctionCallContent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dd30286. Simplified the struct by removing the XML doc comment and directly accessing Response.FunctionCall.

…ctionaryStringObject

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Copilot AI requested a review from jozkee January 14, 2026 18:08
Undo unneeded changes
Updated OpenAIResponsesChatClient
Updated tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants