Skip to content

MCPApprovalResponse implementation lacks public setters #511

Description

@keiserS

Bug Report

Overview

 public sealed class MCPApprovalResponse : BaseResponse, IResponseItem
 {...

        [JsonInclude]
        [JsonPropertyName("approval_request_id")]
        public string ApprovalRequestId { get; set; }                                              // <<<<<<<<<<<<<  public setter

        [JsonInclude]
        [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
        [JsonPropertyName("approve")]
        public bool Approve { get; set; }                                              // <<<<<<<<<<<<<  public setter
...
}

It's not possible to respond to the Approval request. Public setters must be available to respond to requests.
Here is the code of usage:

  response = await api.ResponsesEndpoint.CreateModelResponseAsync(request, StreamCallback);
  // Check if there are pending approvals
  if (pendingApprovals.Any())
  {
      // Add the response output to conversation (this includes approval requests)
      // Add approval responses for all pending approvals
      foreach (var approval in pendingApprovals)
      {
          conversation.Add(new MCPApprovalResponse                    // <<<<<<<<<<<<<<< check this
          {
              ApprovalRequestId = approval.Id,
              Approve = true,
          });
      }

      // Clear the list
      pendingApprovals.Clear();

      // Update request for next iteration
      request = new(conversation, _model, tools: tools);

      // Continue the loop to make another API call
      continue;
  }

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions