Class Tool.Mcp
-
- All Implemented Interfaces:
public final class Tool.McpGive the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classTool.Mcp.BuilderA builder for Mcp.
public final classTool.Mcp.AllowedToolsList of allowed tool names or a filter object.
public final classTool.Mcp.ConnectorIdIdentifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:Dropbox:
connector_dropboxGmail:
connector_gmailGoogle Calendar:
connector_googlecalendarGoogle Drive:
connector_googledriveMicrosoft Teams:
connector_microsoftteamsOutlook Calendar:
connector_outlookcalendarOutlook Email:
connector_outlookemailSharePoint:
connector_sharepoint
public final classTool.Mcp.HeadersOptional HTTP headers to send to the MCP server. Use for authentication or other purposes.
public final classTool.Mcp.RequireApprovalSpecify which of the MCP server's tools require approval.
-
Method Summary
Modifier and Type Method Description final StringserverLabel()A label for this MCP server, used to identify it in tool calls. final JsonValue_type()The type of the MCP tool. final Optional<Tool.Mcp.AllowedTools>allowedTools()List of allowed tool names or a filter object. final Optional<String>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. final Optional<Tool.Mcp.ConnectorId>connectorId()Identifier for service connectors, like those available in ChatGPT. final Optional<Boolean>deferLoading()Whether this MCP tool is deferred and discovered via tool search. final Optional<Tool.Mcp.Headers>headers()Optional HTTP headers to send to the MCP server. final Optional<Tool.Mcp.RequireApproval>requireApproval()Specify which of the MCP server's tools require approval. final Optional<String>serverDescription()Optional description of the MCP server, used to provide more context. final Optional<String>serverUrl()The URL for the MCP server. final JsonField<String>_serverLabel()Returns the raw JSON value of serverLabel. final JsonField<Tool.Mcp.AllowedTools>_allowedTools()Returns the raw JSON value of allowedTools. final JsonField<String>_authorization()Returns the raw JSON value of authorization. final JsonField<Tool.Mcp.ConnectorId>_connectorId()Returns the raw JSON value of connectorId. final JsonField<Boolean>_deferLoading()Returns the raw JSON value of deferLoading. final JsonField<Tool.Mcp.Headers>_headers()Returns the raw JSON value of headers. final JsonField<Tool.Mcp.RequireApproval>_requireApproval()Returns the raw JSON value of requireApproval. final JsonField<String>_serverDescription()Returns the raw JSON value of serverDescription. final JsonField<String>_serverUrl()Returns the raw JSON value of serverUrl. final Map<String, JsonValue>_additionalProperties()final Tool.Mcp.BuildertoBuilder()final Tool.Mcpvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static Tool.Mcp.Builderbuilder()Returns a mutable builder for constructing an instance of Mcp. -
-
Method Detail
-
serverLabel
final String serverLabel()
A label for this MCP server, used to identify it in tool calls.
-
_type
final JsonValue _type()
The type of the MCP tool. Always
mcp.Expected to always return the following:
JsonValue.from("mcp")However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
allowedTools
final Optional<Tool.Mcp.AllowedTools> allowedTools()
List of allowed tool names or a filter object.
-
authorization
final Optional<String> 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.
-
connectorId
final Optional<Tool.Mcp.ConnectorId> connectorId()
Identifier for service connectors, like those available in ChatGPT. One of
server_urlorconnector_idmust be provided. Learn more about service connectors here.Currently supported
connector_idvalues are:Dropbox:
connector_dropboxGmail:
connector_gmailGoogle Calendar:
connector_googlecalendarGoogle Drive:
connector_googledriveMicrosoft Teams:
connector_microsoftteamsOutlook Calendar:
connector_outlookcalendarOutlook Email:
connector_outlookemailSharePoint:
connector_sharepoint
-
deferLoading
final Optional<Boolean> deferLoading()
Whether this MCP tool is deferred and discovered via tool search.
-
headers
final Optional<Tool.Mcp.Headers> headers()
Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
-
requireApproval
final Optional<Tool.Mcp.RequireApproval> requireApproval()
Specify which of the MCP server's tools require approval.
-
serverDescription
final Optional<String> serverDescription()
Optional description of the MCP server, used to provide more context.
-
serverUrl
final Optional<String> serverUrl()
The URL for the MCP server. One of
server_urlorconnector_idmust be provided.
-
_serverLabel
final JsonField<String> _serverLabel()
Returns the raw JSON value of serverLabel.
Unlike serverLabel, this method doesn't throw if the JSON field has an unexpected type.
-
_allowedTools
final JsonField<Tool.Mcp.AllowedTools> _allowedTools()
Returns the raw JSON value of allowedTools.
Unlike allowedTools, this method doesn't throw if the JSON field has an unexpected type.
-
_authorization
final JsonField<String> _authorization()
Returns the raw JSON value of authorization.
Unlike authorization, this method doesn't throw if the JSON field has an unexpected type.
-
_connectorId
final JsonField<Tool.Mcp.ConnectorId> _connectorId()
Returns the raw JSON value of connectorId.
Unlike connectorId, this method doesn't throw if the JSON field has an unexpected type.
-
_deferLoading
final JsonField<Boolean> _deferLoading()
Returns the raw JSON value of deferLoading.
Unlike deferLoading, this method doesn't throw if the JSON field has an unexpected type.
-
_headers
final JsonField<Tool.Mcp.Headers> _headers()
Returns the raw JSON value of headers.
Unlike headers, this method doesn't throw if the JSON field has an unexpected type.
-
_requireApproval
final JsonField<Tool.Mcp.RequireApproval> _requireApproval()
Returns the raw JSON value of requireApproval.
Unlike requireApproval, this method doesn't throw if the JSON field has an unexpected type.
-
_serverDescription
final JsonField<String> _serverDescription()
Returns the raw JSON value of serverDescription.
Unlike serverDescription, this method doesn't throw if the JSON field has an unexpected type.
-
_serverUrl
final JsonField<String> _serverUrl()
Returns the raw JSON value of serverUrl.
Unlike serverUrl, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final Tool.Mcp.Builder toBuilder()
-
validate
final Tool.Mcp validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
builder
final static Tool.Mcp.Builder builder()
Returns a mutable builder for constructing an instance of Mcp.
The following fields are required:
.serverLabel()
-
-
-
-