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
4 changes: 2 additions & 2 deletions api/OpenAI.net8.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4910,7 +4910,7 @@ public class McpToolCallApprovalPolicy : IJsonModel<McpToolCallApprovalPolicy>,
}
[Experimental("OPENAI001")]
public class McpToolCallApprovalRequestItem : ResponseItem, IJsonModel<McpToolCallApprovalRequestItem>, IPersistableModel<McpToolCallApprovalRequestItem> {
public McpToolCallApprovalRequestItem(string serverLabel, string toolName, BinaryData toolArguments);
public McpToolCallApprovalRequestItem(string id, string serverLabel, string toolName, BinaryData toolArguments);
public string ServerLabel { get; set; }
public BinaryData ToolArguments { get; set; }
public string ToolName { get; set; }
Expand Down Expand Up @@ -5298,7 +5298,7 @@ public class ResponseItem : IJsonModel<ResponseItem>, IPersistableModel<Response
public static FileSearchCallResponseItem CreateFileSearchCallItem(IEnumerable<string> queries);
public static FunctionCallResponseItem CreateFunctionCallItem(string callId, string functionName, BinaryData functionArguments);
public static FunctionCallOutputResponseItem CreateFunctionCallOutputItem(string callId, string functionOutput);
public static McpToolCallApprovalRequestItem CreateMcpApprovalRequestItem(string serverLabel, string name, BinaryData arguments);
public static McpToolCallApprovalRequestItem CreateMcpApprovalRequestItem(string id, string serverLabel, string name, BinaryData arguments);
public static McpToolCallApprovalResponseItem CreateMcpApprovalResponseItem(string approvalRequestId, bool approved);
public static McpToolCallItem CreateMcpToolCallItem(string serverLabel, string name, BinaryData arguments);
public static McpToolDefinitionListItem CreateMcpToolDefinitionListItem(string serverLabel, IEnumerable<McpToolDefinition> toolDefinitions);
Expand Down
4 changes: 2 additions & 2 deletions api/OpenAI.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4314,7 +4314,7 @@ public class McpToolCallApprovalPolicy : IJsonModel<McpToolCallApprovalPolicy>,
protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
}
public class McpToolCallApprovalRequestItem : ResponseItem, IJsonModel<McpToolCallApprovalRequestItem>, IPersistableModel<McpToolCallApprovalRequestItem> {
public McpToolCallApprovalRequestItem(string serverLabel, string toolName, BinaryData toolArguments);
public McpToolCallApprovalRequestItem(string id, string serverLabel, string toolName, BinaryData toolArguments);
public string ServerLabel { get; set; }
public BinaryData ToolArguments { get; set; }
public string ToolName { get; set; }
Expand Down Expand Up @@ -4672,7 +4672,7 @@ public class ResponseItem : IJsonModel<ResponseItem>, IPersistableModel<Response
public static FileSearchCallResponseItem CreateFileSearchCallItem(IEnumerable<string> queries);
public static FunctionCallResponseItem CreateFunctionCallItem(string callId, string functionName, BinaryData functionArguments);
public static FunctionCallOutputResponseItem CreateFunctionCallOutputItem(string callId, string functionOutput);
public static McpToolCallApprovalRequestItem CreateMcpApprovalRequestItem(string serverLabel, string name, BinaryData arguments);
public static McpToolCallApprovalRequestItem CreateMcpApprovalRequestItem(string id, string serverLabel, string name, BinaryData arguments);
public static McpToolCallApprovalResponseItem CreateMcpApprovalResponseItem(string approvalRequestId, bool approved);
public static McpToolCallItem CreateMcpToolCallItem(string serverLabel, string name, BinaryData arguments);
public static McpToolDefinitionListItem CreateMcpToolDefinitionListItem(string serverLabel, IEnumerable<McpToolDefinition> toolDefinitions);
Expand Down
21 changes: 13 additions & 8 deletions specification/client/responses.client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ using Azure.ClientGenerator.Core;
@@alternateType(CreateResponse.service_tier, DotNetResponseServiceTier);
@@alternateType(Response.service_tier, DotNetResponseServiceTier);

@@visibility(ItemResource.id, Lifecycle.Read);
// ------------ ItemResources ------------
@@usage(ItemResource, Usage.input | Usage.output);
@@visibility(ItemResource.id, Lifecycle.Read);

@@visibility(ComputerToolCallItemResource.status, Lifecycle.Read);

Expand All @@ -31,13 +32,6 @@ using Azure.ClientGenerator.Core;

@@visibility(ResponsesMessageItemResource.status, Lifecycle.Read);

@@clientName(FileSearchTool.max_num_results, "MaxResultCount");

@@clientName(FunctionTool.name, "FunctionName");
@@clientName(FunctionTool.description, "FunctionDescription");
@@clientName(FunctionTool.parameters, "FunctionParameters");
@@clientName(FunctionTool.strict, "StrictModeEnabled");

@@alternateType(MCPApprovalRequestItemResource.arguments, unknown);
@@clientName(MCPApprovalRequestItemResource.name, "ToolName");
@@clientName(MCPApprovalRequestItemResource.arguments, "ToolArguments");
Expand All @@ -53,9 +47,20 @@ using Azure.ClientGenerator.Core;
@@alternateType(MCPListToolsItemResource.error, unknown);
@@clientName(MCPListToolsItemResource.tools, "ToolDefinitions");

// ------------ Tools ------------

@@clientName(FileSearchTool.max_num_results, "MaxResultCount");

@@clientName(FunctionTool.name, "FunctionName");
@@clientName(FunctionTool.description, "FunctionDescription");
@@clientName(FunctionTool.parameters, "FunctionParameters");
@@clientName(FunctionTool.strict, "StrictModeEnabled");

@@alternateType(MCPTool.server_url, url);
@@clientName(MCPTool.server_url, "ServerUri");

// ------------ Streaming ------------

@@alternateType(ResponseFunctionCallArgumentsDoneEvent.arguments, unknown);
// @@clientName(ResponseFunctionCallArgumentsDoneEvent.arguments, "FunctionArguments");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
namespace OpenAI.Responses;
using System;

// CUSTOM: Renamed.
namespace OpenAI.Responses;

// CUSTOM:
// - Renamed.
// - Made internal the constructor that does not take the item ID as a parameter. This is because MCP
// approval requests are correlated to MCP approval responses using this ID. Therefore, it
// implies that the ID of MCP approval requests is required. Note that this is contrary to other
// similar cases, such as function call items, which are instead correlated to function call
// outputs using a dedicated "call ID".
[CodeGenType("MCPApprovalRequestItemResource")]
[CodeGenVisibility(nameof(McpToolCallApprovalRequestItem), CodeGenVisibility.Internal, typeof(string), typeof(string), typeof(BinaryData))]
public partial class McpToolCallApprovalRequestItem
{
// CUSTOM: Added a constructor that takes the item ID.
public McpToolCallApprovalRequestItem(string id, string serverLabel, string toolName, BinaryData toolArguments) : base(InternalItemType.McpApprovalRequest)
{
Argument.AssertNotNull(id, nameof(id));
Argument.AssertNotNull(serverLabel, nameof(serverLabel));
Argument.AssertNotNull(toolName, nameof(toolName));
Argument.AssertNotNull(toolArguments, nameof(toolArguments));

Id = id;
ServerLabel = serverLabel;
ToolName = toolName;
ToolArguments = toolArguments;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ namespace OpenAI.Responses;

// CUSTOM:
// - Renamed.
// - Made internal the constructor that does not take an ID, because contrary to other item types,
// the ID of reference items is not read-only and is required.
// - Made internal the constructor that does not take the item ID, because contrary to other item
// types, the ID of reference items is not read-only and is required.
[CodeGenType("DotNetItemReferenceItemResource")]
[CodeGenVisibility(nameof(ReferenceResponseItem), CodeGenVisibility.Internal)]
public partial class ReferenceResponseItem
{
// CUSTOM: Added a constructor that takes an ID.
// CUSTOM: Added a constructor that takes the item ID.
public ReferenceResponseItem(string id) : base(InternalItemType.ItemReference)
{
Argument.AssertNotNull(id, nameof(id));
Expand Down
4 changes: 2 additions & 2 deletions src/Custom/Responses/Items/ResponseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public static ReferenceResponseItem CreateReferenceItem(string id)
return new ReferenceResponseItem(id);
}

public static McpToolCallApprovalRequestItem CreateMcpApprovalRequestItem(string serverLabel, string name, BinaryData arguments)
public static McpToolCallApprovalRequestItem CreateMcpApprovalRequestItem(string id, string serverLabel, string name, BinaryData arguments)
{
return new McpToolCallApprovalRequestItem(serverLabel, name, arguments);
return new McpToolCallApprovalRequestItem(id, serverLabel, name, arguments);
}

public static McpToolCallApprovalResponseItem CreateMcpApprovalResponseItem(string approvalRequestId, bool approved)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace OpenAI.Responses
[Experimental("OPENAI001")]
public partial class McpToolCallApprovalRequestItem : ResponseItem
{
public McpToolCallApprovalRequestItem(string serverLabel, string toolName, BinaryData toolArguments) : base(InternalItemType.McpApprovalRequest)
internal McpToolCallApprovalRequestItem(string serverLabel, string toolName, BinaryData toolArguments) : base(InternalItemType.McpApprovalRequest)
{
Argument.AssertNotNull(serverLabel, nameof(serverLabel));
Argument.AssertNotNull(toolName, nameof(toolName));
Expand Down