Class MCPTool
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. https://platform.openai.com/docs/guides/tools-remote-mcp
public sealed class MCPTool : ITool
- Inheritance
-
MCPTool
- Implements
- Inherited Members
Constructors
MCPTool()
public MCPTool()
MCPTool(string, string, string, string, string, IReadOnlyList<object>, IReadOnlyDictionary<string, object>, object)
public MCPTool(string serverLabel, string serverUrl = null, string connectorId = null, string authorization = null, string serverDescription = null, IReadOnlyList<object> allowedTools = null, IReadOnlyDictionary<string, object> headers = null, object requireApproval = null)
Parameters
serverLabelstringserverUrlstringconnectorIdstringauthorizationstringserverDescriptionstringallowedToolsIReadOnlyList<object>headersIReadOnlyDictionary<string, object>requireApprovalobject
MCPTool(string, string, string, string, string, IReadOnlyList<string>, IReadOnlyDictionary<string, object>, MCPApprovalFilter)
public MCPTool(string serverLabel, string serverUrl, string connectorId, string authorization, string serverDescription, IReadOnlyList<string> allowedTools, IReadOnlyDictionary<string, object> headers, MCPApprovalFilter requireApproval)
Parameters
serverLabelstringserverUrlstringconnectorIdstringauthorizationstringserverDescriptionstringallowedToolsIReadOnlyList<string>headersIReadOnlyDictionary<string, object>requireApprovalMCPApprovalFilter
MCPTool(string, string, string, string, string, IReadOnlyList<string>, IReadOnlyDictionary<string, object>, MCPToolRequireApproval)
public MCPTool(string serverLabel, string serverUrl, string connectorId, string authorization, string serverDescription, IReadOnlyList<string> allowedTools, IReadOnlyDictionary<string, object> headers, MCPToolRequireApproval requireApproval)
Parameters
serverLabelstringserverUrlstringconnectorIdstringauthorizationstringserverDescriptionstringallowedToolsIReadOnlyList<string>headersIReadOnlyDictionary<string, object>requireApprovalMCPToolRequireApproval
Properties
AllowedTools
List of allowed tool names.
[JsonInclude]
[JsonPropertyName("allowed_tools")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<object> AllowedTools { get; }
Property Value
Authorization
An OAuth access token that can be used with a remote MCP server, either with a custom MCP server URL or a service connector. Your application must handle the OAuth authorization flow and provide the token here.
[JsonInclude]
[JsonPropertyName("authorization")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string Authorization { get; }
Property Value
ConnectorId
Identifier for service connectors, like those available in ChatGPT. One of
ServerUrl or ConnectorId must be provided. Learn more about service
connectors https://platform.openai.com/docs/guides/tools-remote-mcp#connectors.
Currently supported connector_id values are:
- Dropbox:
connector_dropbox - Gmail:
connector_gmail - Google Calendar:
connector_googlecalendar - Google Drive:
connector_googledrive - Microsoft Teams:
connector_microsoftteams - Outlook Calendar:
connector_outlookcalendar - Outlook Email:
connector_outlookemail - SharePoint:
connector_sharepoint
[JsonInclude]
[JsonPropertyName("connector_id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string ConnectorId { get; }
Property Value
Headers
Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
[JsonInclude]
[JsonPropertyName("headers")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyDictionary<string, object> Headers { get; }
Property Value
RequireApproval
Specify which of the MCP server's tools require approval. Can be one of MCPApprovalFilter, "always", or "never". When set to "never", all tools will not require approval.
[JsonInclude]
[JsonPropertyName("require_approval")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(StringOrObjectConverter<MCPApprovalFilter>))]
public object RequireApproval { get; }
Property Value
ServerDescription
Optional description of the MCP server, used to provide more context.
[JsonInclude]
[JsonPropertyName("server_description")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string ServerDescription { get; }
Property Value
ServerLabel
A label for this MCP server, used to identify it in tool calls.
[JsonInclude]
[JsonPropertyName("server_label")]
public string ServerLabel { get; }
Property Value
ServerUrl
The URL for the MCP server.
[JsonInclude]
[JsonPropertyName("server_url")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string ServerUrl { get; }
Property Value
Type
[JsonInclude]
[JsonPropertyName("type")]
public string Type { get; }
Property Value
Operators
implicit operator Tool(MCPTool)
public static implicit operator Tool(MCPTool mcpTool)
Parameters
mcpToolMCPTool