Skip to content

Commit 1783957

Browse files
committed
Add support for authorization token and connectors to McpTool
1 parent 3094238 commit 1783957

File tree

42 files changed

+13578
-13406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+13578
-13406
lines changed

api/OpenAI.net8.0.cs

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4898,9 +4898,13 @@ public class FunctionTool : ResponseTool, IJsonModel<FunctionTool>, IPersistable
48984898
}
48994899
[Experimental("OPENAI001")]
49004900
public class McpTool : ResponseTool, IJsonModel<McpTool>, IPersistableModel<McpTool> {
4901+
public McpTool(string serverLabel, McpToolConnectorId connectorId);
49014902
public McpTool(string serverLabel, Uri serverUri);
49024903
public McpToolFilter AllowedTools { get; set; }
4904+
public string AuthorizationToken { get; set; }
4905+
public McpToolConnectorId? ConnectorId { get; set; }
49034906
public IDictionary<string, string> Headers { get; set; }
4907+
public string ServerDescription { get; set; }
49044908
public string ServerLabel { get; set; }
49054909
public Uri ServerUri { get; set; }
49064910
public McpToolCallApprovalPolicy ToolCallApprovalPolicy { get; set; }
@@ -4956,6 +4960,28 @@ public class McpToolCallItem : ResponseItem, IJsonModel<McpToolCallItem>, IPersi
49564960
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
49574961
}
49584962
[Experimental("OPENAI001")]
4963+
public readonly partial struct McpToolConnectorId : IEquatable<McpToolConnectorId> {
4964+
public McpToolConnectorId(string value);
4965+
public static McpToolConnectorId Dropbox { get; }
4966+
public static McpToolConnectorId Gmail { get; }
4967+
public static McpToolConnectorId GoogleCalendar { get; }
4968+
public static McpToolConnectorId GoogleDrive { get; }
4969+
public static McpToolConnectorId MicrosoftTeams { get; }
4970+
public static McpToolConnectorId OutlookCalendar { get; }
4971+
public static McpToolConnectorId OutlookEmail { get; }
4972+
public static McpToolConnectorId SharePoint { get; }
4973+
public readonly bool Equals(McpToolConnectorId other);
4974+
[EditorBrowsable(EditorBrowsableState.Never)]
4975+
public override readonly bool Equals(object obj);
4976+
[EditorBrowsable(EditorBrowsableState.Never)]
4977+
public override readonly int GetHashCode();
4978+
public static bool operator ==(McpToolConnectorId left, McpToolConnectorId right);
4979+
public static implicit operator McpToolConnectorId(string value);
4980+
public static implicit operator McpToolConnectorId?(string value);
4981+
public static bool operator !=(McpToolConnectorId left, McpToolConnectorId right);
4982+
public override readonly string ToString();
4983+
}
4984+
[Experimental("OPENAI001")]
49594985
public class McpToolDefinition : IJsonModel<McpToolDefinition>, IPersistableModel<McpToolDefinition> {
49604986
public McpToolDefinition(string name, BinaryData inputSchema);
49614987
public BinaryData Annotations { get; set; }
@@ -4980,6 +5006,7 @@ public class McpToolDefinitionListItem : ResponseItem, IJsonModel<McpToolDefinit
49805006
}
49815007
[Experimental("OPENAI001")]
49825008
public class McpToolFilter : IJsonModel<McpToolFilter>, IPersistableModel<McpToolFilter> {
5009+
public bool? IsReadOnly { get; set; }
49835010
public IList<string> ToolNames { get; }
49845011
protected virtual McpToolFilter JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
49855012
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
@@ -5491,7 +5518,8 @@ public class ResponseTool : IJsonModel<ResponseTool>, IPersistableModel<Response
54915518
public static ComputerTool CreateComputerTool(ComputerToolEnvironment environment, int displayWidth, int displayHeight);
54925519
public static FileSearchTool CreateFileSearchTool(IEnumerable<string> vectorStoreIds, int? maxResultCount = null, FileSearchToolRankingOptions rankingOptions = null, BinaryData filters = null);
54935520
public static FunctionTool CreateFunctionTool(string functionName, BinaryData functionParameters, bool? strictModeEnabled, string functionDescription = null);
5494-
public static McpTool CreateMcpTool(string serverLabel, Uri serverUri, IDictionary<string, string> headers = null, McpToolFilter allowedTools = null, McpToolCallApprovalPolicy toolCallApprovalPolicy = null);
5521+
public static McpTool CreateMcpTool(string serverLabel, McpToolConnectorId connectorId, string authorizationToken = null, string serverDescription = null, IDictionary<string, string> headers = null, McpToolFilter allowedTools = null, McpToolCallApprovalPolicy toolCallApprovalPolicy = null);
5522+
public static McpTool CreateMcpTool(string serverLabel, Uri serverUri, string authorizationToken = null, string serverDescription = null, IDictionary<string, string> headers = null, McpToolFilter allowedTools = null, McpToolCallApprovalPolicy toolCallApprovalPolicy = null);
54955523
public static WebSearchTool CreateWebSearchTool(WebSearchToolLocation userLocation = null, WebSearchToolContextSize? searchContextSize = null);
54965524
protected virtual ResponseTool JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
54975525
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
@@ -5679,13 +5707,17 @@ public class StreamingResponseMcpCallArgumentsDoneUpdate : StreamingResponseUpda
56795707
}
56805708
[Experimental("OPENAI001")]
56815709
public class StreamingResponseMcpCallCompletedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpCallCompletedUpdate>, IPersistableModel<StreamingResponseMcpCallCompletedUpdate> {
5710+
public string ItemId { get; }
5711+
public int OutputIndex { get; }
56825712
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
56835713
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
56845714
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
56855715
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
56865716
}
56875717
[Experimental("OPENAI001")]
56885718
public class StreamingResponseMcpCallFailedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpCallFailedUpdate>, IPersistableModel<StreamingResponseMcpCallFailedUpdate> {
5719+
public string ItemId { get; }
5720+
public int OutputIndex { get; }
56895721
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
56905722
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
56915723
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
@@ -5702,20 +5734,26 @@ public class StreamingResponseMcpCallInProgressUpdate : StreamingResponseUpdate,
57025734
}
57035735
[Experimental("OPENAI001")]
57045736
public class StreamingResponseMcpListToolsCompletedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpListToolsCompletedUpdate>, IPersistableModel<StreamingResponseMcpListToolsCompletedUpdate> {
5737+
public string ItemId { get; }
5738+
public int OutputIndex { get; }
57055739
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
57065740
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
57075741
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
57085742
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
57095743
}
57105744
[Experimental("OPENAI001")]
57115745
public class StreamingResponseMcpListToolsFailedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpListToolsFailedUpdate>, IPersistableModel<StreamingResponseMcpListToolsFailedUpdate> {
5746+
public string ItemId { get; }
5747+
public int OutputIndex { get; }
57125748
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
57135749
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
57145750
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
57155751
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
57165752
}
57175753
[Experimental("OPENAI001")]
57185754
public class StreamingResponseMcpListToolsInProgressUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpListToolsInProgressUpdate>, IPersistableModel<StreamingResponseMcpListToolsInProgressUpdate> {
5755+
public string ItemId { get; }
5756+
public int OutputIndex { get; }
57195757
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
57205758
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
57215759
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);

api/OpenAI.netstandard2.0.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4304,9 +4304,13 @@ public class FunctionTool : ResponseTool, IJsonModel<FunctionTool>, IPersistable
43044304
public override readonly string ToString();
43054305
}
43064306
public class McpTool : ResponseTool, IJsonModel<McpTool>, IPersistableModel<McpTool> {
4307+
public McpTool(string serverLabel, McpToolConnectorId connectorId);
43074308
public McpTool(string serverLabel, Uri serverUri);
43084309
public McpToolFilter AllowedTools { get; set; }
4310+
public string AuthorizationToken { get; set; }
4311+
public McpToolConnectorId? ConnectorId { get; set; }
43094312
public IDictionary<string, string> Headers { get; set; }
4313+
public string ServerDescription { get; set; }
43104314
public string ServerLabel { get; set; }
43114315
public Uri ServerUri { get; set; }
43124316
public McpToolCallApprovalPolicy ToolCallApprovalPolicy { get; set; }
@@ -4357,6 +4361,27 @@ public class McpToolCallItem : ResponseItem, IJsonModel<McpToolCallItem>, IPersi
43574361
protected override ResponseItem PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
43584362
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
43594363
}
4364+
public readonly partial struct McpToolConnectorId : IEquatable<McpToolConnectorId> {
4365+
public McpToolConnectorId(string value);
4366+
public static McpToolConnectorId Dropbox { get; }
4367+
public static McpToolConnectorId Gmail { get; }
4368+
public static McpToolConnectorId GoogleCalendar { get; }
4369+
public static McpToolConnectorId GoogleDrive { get; }
4370+
public static McpToolConnectorId MicrosoftTeams { get; }
4371+
public static McpToolConnectorId OutlookCalendar { get; }
4372+
public static McpToolConnectorId OutlookEmail { get; }
4373+
public static McpToolConnectorId SharePoint { get; }
4374+
public readonly bool Equals(McpToolConnectorId other);
4375+
[EditorBrowsable(EditorBrowsableState.Never)]
4376+
public override readonly bool Equals(object obj);
4377+
[EditorBrowsable(EditorBrowsableState.Never)]
4378+
public override readonly int GetHashCode();
4379+
public static bool operator ==(McpToolConnectorId left, McpToolConnectorId right);
4380+
public static implicit operator McpToolConnectorId(string value);
4381+
public static implicit operator McpToolConnectorId?(string value);
4382+
public static bool operator !=(McpToolConnectorId left, McpToolConnectorId right);
4383+
public override readonly string ToString();
4384+
}
43604385
public class McpToolDefinition : IJsonModel<McpToolDefinition>, IPersistableModel<McpToolDefinition> {
43614386
public McpToolDefinition(string name, BinaryData inputSchema);
43624387
public BinaryData Annotations { get; set; }
@@ -4379,6 +4404,7 @@ public class McpToolDefinitionListItem : ResponseItem, IJsonModel<McpToolDefinit
43794404
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
43804405
}
43814406
public class McpToolFilter : IJsonModel<McpToolFilter>, IPersistableModel<McpToolFilter> {
4407+
public bool? IsReadOnly { get; set; }
43824408
public IList<string> ToolNames { get; }
43834409
protected virtual McpToolFilter JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
43844410
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
@@ -4849,7 +4875,8 @@ public class ResponseTool : IJsonModel<ResponseTool>, IPersistableModel<Response
48494875
public static ComputerTool CreateComputerTool(ComputerToolEnvironment environment, int displayWidth, int displayHeight);
48504876
public static FileSearchTool CreateFileSearchTool(IEnumerable<string> vectorStoreIds, int? maxResultCount = null, FileSearchToolRankingOptions rankingOptions = null, BinaryData filters = null);
48514877
public static FunctionTool CreateFunctionTool(string functionName, BinaryData functionParameters, bool? strictModeEnabled, string functionDescription = null);
4852-
public static McpTool CreateMcpTool(string serverLabel, Uri serverUri, IDictionary<string, string> headers = null, McpToolFilter allowedTools = null, McpToolCallApprovalPolicy toolCallApprovalPolicy = null);
4878+
public static McpTool CreateMcpTool(string serverLabel, McpToolConnectorId connectorId, string authorizationToken = null, string serverDescription = null, IDictionary<string, string> headers = null, McpToolFilter allowedTools = null, McpToolCallApprovalPolicy toolCallApprovalPolicy = null);
4879+
public static McpTool CreateMcpTool(string serverLabel, Uri serverUri, string authorizationToken = null, string serverDescription = null, IDictionary<string, string> headers = null, McpToolFilter allowedTools = null, McpToolCallApprovalPolicy toolCallApprovalPolicy = null);
48534880
public static WebSearchTool CreateWebSearchTool(WebSearchToolLocation userLocation = null, WebSearchToolContextSize? searchContextSize = null);
48544881
protected virtual ResponseTool JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
48554882
protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
@@ -5017,12 +5044,16 @@ public class StreamingResponseMcpCallArgumentsDoneUpdate : StreamingResponseUpda
50175044
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
50185045
}
50195046
public class StreamingResponseMcpCallCompletedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpCallCompletedUpdate>, IPersistableModel<StreamingResponseMcpCallCompletedUpdate> {
5047+
public string ItemId { get; }
5048+
public int OutputIndex { get; }
50205049
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
50215050
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
50225051
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
50235052
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
50245053
}
50255054
public class StreamingResponseMcpCallFailedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpCallFailedUpdate>, IPersistableModel<StreamingResponseMcpCallFailedUpdate> {
5055+
public string ItemId { get; }
5056+
public int OutputIndex { get; }
50265057
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
50275058
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
50285059
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
@@ -5037,18 +5068,24 @@ public class StreamingResponseMcpCallInProgressUpdate : StreamingResponseUpdate,
50375068
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
50385069
}
50395070
public class StreamingResponseMcpListToolsCompletedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpListToolsCompletedUpdate>, IPersistableModel<StreamingResponseMcpListToolsCompletedUpdate> {
5071+
public string ItemId { get; }
5072+
public int OutputIndex { get; }
50405073
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
50415074
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
50425075
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
50435076
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
50445077
}
50455078
public class StreamingResponseMcpListToolsFailedUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpListToolsFailedUpdate>, IPersistableModel<StreamingResponseMcpListToolsFailedUpdate> {
5079+
public string ItemId { get; }
5080+
public int OutputIndex { get; }
50465081
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
50475082
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
50485083
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);
50495084
protected override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options);
50505085
}
50515086
public class StreamingResponseMcpListToolsInProgressUpdate : StreamingResponseUpdate, IJsonModel<StreamingResponseMcpListToolsInProgressUpdate>, IPersistableModel<StreamingResponseMcpListToolsInProgressUpdate> {
5087+
public string ItemId { get; }
5088+
public int OutputIndex { get; }
50525089
protected override StreamingResponseUpdate JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options);
50535090
protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options);
50545091
protected override StreamingResponseUpdate PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options);

0 commit comments

Comments
 (0)