Class: OpenAI::Models::Responses::Tool::Mcp

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/responses/tool.rb

Defined Under Namespace

Modules: AllowedTools, ConnectorID, RequireApproval

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(server_label:, allowed_tools: nil, authorization: nil, connector_id: nil, defer_loading: nil, headers: nil, require_approval: nil, server_description: nil, server_url: nil, type: :mcp) ⇒ Object

Some parameter documentations has been truncated, see OpenAI::Models::Responses::Tool::Mcp for more details.

Give the model access to additional tools via remote Model Context Protocol (MCP) servers. [Learn more about MCP](platform.openai.com/docs/guides/tools-remote-mcp).

Parameters:

  • server_label (String)

    A label for this MCP server, used to identify it in tool calls.

  • allowed_tools (Array<String>, OpenAI::Models::Responses::Tool::Mcp::AllowedTools::McpToolFilter, nil) (defaults to: nil)

    List of allowed tool names or a filter object.

  • authorization (String) (defaults to: nil)

    An OAuth access token that can be used with a remote MCP server, either

  • connector_id (Symbol, OpenAI::Models::Responses::Tool::Mcp::ConnectorID) (defaults to: nil)

    Identifier for service connectors, like those available in ChatGPT. One of

  • defer_loading (Boolean) (defaults to: nil)

    Whether this MCP tool is deferred and discovered via tool search.

  • headers (Hash{Symbol=>String}, nil) (defaults to: nil)

    Optional HTTP headers to send to the MCP server. Use for authentication

  • require_approval (OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter, Symbol, OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalSetting, nil) (defaults to: nil)

    Specify which of the MCP server’s tools require approval.

  • server_description (String) (defaults to: nil)

    Optional description of the MCP server, used to provide more context.

  • server_url (String) (defaults to: nil)

    The URL for the MCP server. One of ‘server_url` or `connector_id` must be

  • type (Symbol, :mcp) (defaults to: :mcp)

    The type of the MCP tool. Always ‘mcp`.



# File 'lib/openai/models/responses/tool.rb', line 140

Instance Attribute Details

#allowed_toolsArray<String>, ...

List of allowed tool names or a filter object.



78
# File 'lib/openai/models/responses/tool.rb', line 78

optional :allowed_tools, union: -> { OpenAI::Responses::Tool::Mcp::AllowedTools }, nil?: true

#authorizationString?

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.

Returns:

  • (String, nil)


86
# File 'lib/openai/models/responses/tool.rb', line 86

optional :authorization, String

#connector_idSymbol, ...

Identifier for service connectors, like those available in ChatGPT. One of ‘server_url` or `connector_id` must be provided. Learn more about service connectors [here](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`



106
# File 'lib/openai/models/responses/tool.rb', line 106

optional :connector_id, enum: -> { OpenAI::Responses::Tool::Mcp::ConnectorID }

#defer_loadingBoolean?

Whether this MCP tool is deferred and discovered via tool search.

Returns:



112
# File 'lib/openai/models/responses/tool.rb', line 112

optional :defer_loading, OpenAI::Internal::Type::Boolean

#headersHash{Symbol=>String}?

Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.

Returns:

  • (Hash{Symbol=>String}, nil)


119
# File 'lib/openai/models/responses/tool.rb', line 119

optional :headers, OpenAI::Internal::Type::HashOf[String], nil?: true

#require_approvalOpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter, ...

Specify which of the MCP server’s tools require approval.



125
# File 'lib/openai/models/responses/tool.rb', line 125

optional :require_approval, union: -> { OpenAI::Responses::Tool::Mcp::RequireApproval }, nil?: true

#server_descriptionString?

Optional description of the MCP server, used to provide more context.

Returns:

  • (String, nil)


131
# File 'lib/openai/models/responses/tool.rb', line 131

optional :server_description, String

#server_labelString

A label for this MCP server, used to identify it in tool calls.

Returns:

  • (String)


66
# File 'lib/openai/models/responses/tool.rb', line 66

required :server_label, String

#server_urlString?

The URL for the MCP server. One of ‘server_url` or `connector_id` must be provided.

Returns:

  • (String, nil)


138
# File 'lib/openai/models/responses/tool.rb', line 138

optional :server_url, String

#typeSymbol, :mcp

The type of the MCP tool. Always ‘mcp`.

Returns:

  • (Symbol, :mcp)


72
# File 'lib/openai/models/responses/tool.rb', line 72

required :type, const: :mcp

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/openai/models/responses/tool.rb', line 244